【问题标题】:Connect UITable Cells to Different Storyboards?将 UITable 单元连接到不同的故事板?
【发布时间】:2012-11-28 18:47:34
【问题描述】:

是否可以将 UITable 中的静态单元格链接到不同的故事板?

如果是这样.. 怎么办?

【问题讨论】:

    标签: uitableview uistoryboard uistoryboardsegue


    【解决方案1】:

    我想通了。 万一其他人遇到这个问题,这里是解决方案..

    确保在主控制器上添加所有 .h 文件 对我来说,他们会是

    #import "tabbar26.h"
    

    现在这是我添加的代码以使其工作

    - (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    UITableViewCell *cell = [super tableView:tableView
                       cellForRowAtIndexPath:indexPath];
    cell.accessoryType = UITableViewCellAccessoryNone;
    
    NSUInteger row = [indexPath row];
    
    
                if (row == 1)
            {
                NSLog(@"hi");
    
            }
    
            if (row == 27)
            {
            }
     }
    
    return cell;
    }
    

    上面这部分,真的不需要。我只是用它来记录。

    下面是你真正需要的:)

     -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath      {
    
    NSUInteger row = [indexPath row];
    
    if (row == 0)
    {
        NSLog(@"hi2");
        }
    
    if (row == 25)
    {
        NSLog(@"bye2");
        UIStoryboard *tabbar26 = [UIStoryboard storyboardWithName:@"tabbar26" bundle:nil];
           UIViewController *Tab1_ViewController = [tabbar26 instantiateInitialViewController];
         [self.navigationController pushViewController:Tab1_ViewController animated:(YES)];
    }
    
    [self.tableView reloadData];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-04-18
      • 1970-01-01
      • 1970-01-01
      • 2013-02-02
      • 1970-01-01
      • 2013-01-28
      • 2012-04-13
      相关资源
      最近更新 更多