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; } }

      

  • 相关阅读:
    Javascript FP-ramdajs
    微信小程序开发
    SPA for HTML5
    One Liners to Impress Your Friends
    Sass (Syntactically Awesome StyleSheets)
    iOS App Icon Template 5.0
    React Native Life Cycle and Communication
    Meteor framework
    RESTful Mongodb
    Server-sent Events
  • 原文地址:https://www.cnblogs.com/dabaomo/p/5267263.html
Copyright © 2011-2022 走看看