IOS第14天(2, Modal控制)
******控制器modal
- (void)btnClick { // 创建控制器对象 HMJumpViewController *jump = [[HMJumpViewController alloc] init]; // [self.view addSubview:jump.view]; // [self addChildViewController:jump]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:jump]; // Modal出一个控制器 [self presentViewController:nav animated:YES completion:nil]; }
******传值,UINavigationController
// 调整之前调用 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { UINavigationController *nav = segue.destinationViewController; // NSLog(@"%@----%@",segue.sourceViewController,segue.destinationViewController); HMTableViewController *tableViewVc = nav.topViewController; tableViewVc.name = @"123123213"; }
没有失败, 只有放弃...