【发布时间】:2013-10-08 21:16:42
【问题描述】:
我在 UITableView 上有问题,如果我将 UITextField 放在 UITableView 中,如果滚动 UITableView,UITextField 中输入的文本将被删除。将这些数据保存在 UITextField 中的任何方式。
我使用了下面的代码
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cell_ID=@"CELL_ID";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cell_ID];
if(cell==nil)
{
NSArray *nib=[[NSBundle mainBundle] loadNibNamed:@"TableViewCellView" owner:self options:nil];
if([nib count]>0)
{
cell=[nib objectAtIndex:0];
}
else
{
NSLog(@"Failed to load nib");
}
}
UITextField *txt1=(UITextField*)[cell viewWithTag:1];//not needed
return cell;
}
我使用 xib 设计了UITableViewCell
提前致谢
【问题讨论】:
-
您是否尝试在表格视图中的 uitextfields 中使用输入数据。然后你应该重新加载你的表格视图。输入数据后
-
我已经在 UITextField 中动态输入了数据,
-
你能用rowatindexpath方法显示你的单元格吗?
-
请出示您使用的代码。
-
我已经包含了代码,现在请检查一下-我已经使用 xib 设计了 UITableViewCell
标签: objective-c uitableview uitextfield