【问题标题】:segue called but not firedsegue 被调用但没有被解雇
【发布时间】:2012-02-07 08:30:05
【问题描述】:

我第一次使用storyboard,遇到segue的问题,我的storyboard是这样的:

                                           __ ViewController
                                          /
                       __ TabBarController
                      /                   \__ ViewController
                     /
 -> TableViewController
                     \
                      \__ NavigationController ___ ViewController

我创建了 2 个 segue,一个用于 TabBarController,一个用于 NavigationController,其标识符为“AddServer”(用于 NavigationController)和“GoMainBoard”(用于 TabBarController)。从带有自定义测试的 TableViewController 中,我使用此代码触发 TabBarController 或 NavigationController

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        [_tbvDownloads deselectRowAtIndexPath:indexPath animated:YES]; 

        if (indexPath.row == [tableView numberOfRowsInSection:0]-1) {
            [self performSegueWithIdentifier:@"AddServer" sender:self];
        } else {
            ...
                [self performSegueWithIdentifier:@"GoMainBoard" sender:self];
            ...
        }
    }

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"AddServer"])
    {
        UINavigationController *navigationController = segue.destinationViewController;
        ...
    }
    if ([segue.identifier isEqualToString:@"GoMainBoard"])
    {
        UITabBarController *tabBar = (UITabBarController *)segue.destinationViewController;
    }
}
  • (void)prepareForSegue 被调用,但我的 TabBarController 没有被触发,谁能解释我哪里出错了?谢谢

【问题讨论】:

    标签: xcode storyboard segue


    【解决方案1】:

    显然,push segue 只能在导航控制器内工作。在其他情况下,您将不得不使用“模态”类型。希望能回答你的问题:)

    另请参阅:segue does not work in simple segue test

    【讨论】:

      猜你喜欢
      • 2013-03-25
      • 2020-03-28
      • 2015-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-22
      相关资源
      最近更新 更多