How to Handle the UiTableviewCell textfields?

别等时光非礼了梦想. 提交于 2019-12-13 06:40:52

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/41073114/how-to-handle-the-uitableviewcell-textfields

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!