如何处理 UiTableviewCell 文本字段? [英] How to Handle the UiTableviewCell textfields?

查看:23
本文介绍了如何处理 UiTableviewCell 文本字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在自定义单元格中有自定义 tableview 单元格我正在使用两个文本字段(名字,年龄).我的问题是如何处理这些文本字段.如果用户不填写这些详细信息,我们会显示警报,假设用户填写如何获取数据的详细信息.Bellow 是我的 tableview 自定义单元格图像.

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.

推荐答案

将所有文本字段添加到 cellForRowAtIndexPath

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.

这篇关于如何处理 UiTableviewCell 文本字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆