淘先锋技术网

首页 1 2 3 4 5 6 7

UINavigationController类方法跳转窗口:

- (void)showViewController:(UIViewController *)vc sender:(id)sender

 

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;

 

storyboard实现窗口跳转:

UIViewController类的方法

- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender

在代码中实现- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender方法,可以进行数据传递,在storyboard中设置

 

实例代码:

[self performSegueWithIdentifier:@"ShowDetail" sender:self];

 

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if ([segue.identifier isEqualToString:@"ShowDetail"]) {

        DetailViewController   *detailViewController = segue.destinationViewController;

        NSInteger selectedIndex = [[self.tableView indexPathForSelectedRow] row];

        NSDictionary *dict = [self.listData objectAtIndex:selectedIndex];

        detailViewController.url = [dict objectForKey:@"url"];

        detailViewController.title = [dict objectForKey:@"name"];

        

    }

}

 

转载于:https://www.cnblogs.com/PJXWang/p/5509032.html