Storyboard跳转传值

1、 Storyboard 模态(或Pop)指定控制器

UIStoryboard *sb_board = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
LoginController *vc_login = [sb_board instantiateViewControllerWithIdentifier:@"LoginController"];
[self  presentViewController:vc_login animated:YES completion:nil];

2、 Storyboard Pop回指定控制器

UIStoryboard *sb_board = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
CateWebController *vc_cate_web = [sb_board instantiateViewControllerWithIdentifier:@"CateWebController"];
for (UIViewController* vc in self.navigationController.viewControllers) {
  if ([vc isKindOfClass:[vc_cate_web class]]) {
    [self.navigationController popToViewController:vc animated:YES];
  }
}

 3、Storyboard(相连接)直接跳转

 self.hidesBottomBarWhenPushed = YES;
[self performSegueWithIdentifier:Identifier sender:self];
self.hidesBottomBarWhenPushed = YES;

  4、Storyboard(相连接)传值

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
    if ([segue.identifier isEqualToString:@"SegueDetail"])
    {
         DetailController *Detail = segue.destinationViewController;
         Detail.strUrl = [NSString stringWithFormat:@"%@",self.str_url];

    }
}

 A-B-C   C-A

http://www.jianshu.com/p/c4d1eb226eaf


原文地址:https://www.cnblogs.com/superbobo/p/5284513.html