【发布时间】:2015-07-14 06:14:24
【问题描述】:
我需要在 UIButton 单击时重新创建 UITableView 部分。这是一个例子。
在按钮点击中它应该是这样创建的。
但我无法实现这一点。
请帮忙。 我只是用 textLabel 创建一个简单的 UITableView。
cellForRowAtIndexPath 的代码是
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableItem";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [tableData objectAtIndex:indexPath.row];
return cell;
}
【问题讨论】:
-
请帮帮我,当用户单击加号按钮或单独的新表格视图时,您想创建一个新行吗?如果是,您打算在哪里添加它,因为您已经在屏幕上有一个表格视图。
-
按钮的touchUpInside事件调用的方法是什么?
-
@ Parvez Belim - 我需要重新创建 uitableview 的所有行,可能在每个类型 uiButton 被点击的新部分中
-
@ ZeMoon- On UIButtons Action 我想创建一个新部分,它重复上一部分的所有行项目。
-
我建议为现有的 tableview 创建新的 Section 而不是创建新的 table view。增加屋顶部分,并在模型中进行更改并重新加载 tableview
标签: ios objective-c iphone uitableview uibutton