【问题标题】:UITableView change styleUITableView 改变风格
【发布时间】:2012-08-11 15:27:37
【问题描述】:

我有一个 uitableView,其中包含我以编程方式创建的不同部分和行

当我点击一行时,我将转到新视图,在导航栏中的新视图中,我有 canel 按钮 使用取消按钮,它应该像后退按钮一样工作,但是当我单击取消时,它会加载表格,但会将表格样式从组更改为普通

提前致谢!

有人知道为什么吗?

你能帮帮我吗 我想知道它为什么会改变。 我应该添加什么以具有相同的类型

这是我的代码:

在第一个表格中,我以编程方式和故事板添加了样式

- (id)initWithStyle:(UITableViewStyle)style
{
style = UITableViewStyleGrouped;
self = [super init];
if (self) {
    self = [super initWithStyle:style];
    monthTitle = [[NSMutableArray alloc] init];
}
return self;
}

按钮代码

-(void)cancelItem{
Report *report = [[Report alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:report animated:YES];
[self.tableView reloadData];

}

编辑

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
_selectedIndex = indexPath.section;
[self.tableView reloadData];
switch (indexPath.section){
    case 0:
        [self performSegueWithIdentifier:@"WorkTime" sender:self];

【问题讨论】:

  • 第二个表格怎么显示?
  • @janusfidel - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { _selectedIndex = indexPath.section; [self.tableView reloadData]; switch (indexPath.section){ case 0: [self performSegueWithIdentifier:@"WorkTime" sender:self];
  • @janusfidel 我在上面添加了编辑
  • 你在使用导航控制器来推送新视图吗???

标签: objective-c ios uitableview storyboard


【解决方案1】:

我们可以设置样式为

[[UITableViewController alloc] initWithStyle:UITableViewStyleGrouped];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-08
    • 2015-06-23
    • 2018-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多