简体   繁体   中英

How to Handle the UiTableviewCell textfields?

i have custom tableview cell in custom cell i am taking the two textfield(First name,Age).My problem is how to handle the these textfields.if user not fill these these details we show the alert, per suppose user fill the details how to fetch the data. Bellow is my tableview custom cell image. 在此处输入图片说明

Add all textfields to NSMutableArray in cellForRowAtIndexPath

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
       [mutableArrary addObject:cell.yourTextField];
       return cell;
}

after that in your button action do like this:

-(IBAction)buttonAction:(id)sender{
  for (UITextField*textField in mutableArray){
  NSLog(@"%@",textField.text);
    }
}

Check there if any text is coming as nil then you can show alert like fill all details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM