zoukankan      html  css  js  c++  java
  • storyboard传值方式

    通过segue传值 在storyboard设置segue的Identifier
     
    segue是连接两个视图控制器交互的线
    sender是触发这个方法执行的对象,比如是单击tableView上的cell跳到下一界面  那么这个cell就是sender
    //此方法在表视图控制器.m文件中最下面
    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller.
       //将当前位置的jid赋值给要跳转的视图控制器的的jid属性 if ([segue.identifier isEqualToString:@"push"]) { UITableViewCell *cell = sender; ChatTableViewController *chatVC = segue.destinationViewController;//跳转的下一界面 NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];//获取位置信息 XMPPJID *jid = self.dataArray[indexPath.row];//根据位置信息找到数据 chatVC.jid = jid; } }

      

  • 相关阅读:
    淘宝网六个质量属性场景
    架构漫谈阅读笔记2
    poj 3304
    poj 2318
    bzoj 4008
    任意模数NTT
    CF623E
    CF712E
    bzoj 1925
    bzoj 4710
  • 原文地址:https://www.cnblogs.com/dabaomo/p/5267263.html
Copyright © 2011-2022 走看看