码迷,mamicode.com
首页 > 其他好文 > 详细

Storyboard界面传值

时间:2015-08-31 23:15:37      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

//当进行界面切换的(Segue形式)执行
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"ToMessage"]) {
        MessageViewController *mvc = segue.destinationViewController;
        mvc.username = @"hanmeimei";
    }
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //执行stroyboard切换动作
    [self performSegueWithIdentifier:@"ToMessage" sender:self];
}

 

 

技术分享

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //执行storyboard切换动作
    //[self performSegueWithIdentifier:@"ToMessage" sender:self];
    
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    MessageViewController *mvc = [sb instantiateViewControllerWithIdentifier:@"Message"];
    mvc.username = @"lilei";
    [self.navigationController pushViewController:mvc animated:YES];
}

 

Storyboard界面传值

标签:

原文地址:http://www.cnblogs.com/caolongs/p/4774139.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!