Reputation: 543
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.
Upvotes: 0
Views: 103
Reputation: 2446
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.
Upvotes: 1