Storyboard使用TableView进行页面跳转传值
来源:互联网 发布:淘宝怎么在百度推广 编辑:程序博客网 时间:2024/05/17 02:03
场景
StoryBoard中
A 界面 TableView
B界面 明细页面
A & B通过Cell的Section Action事件进行页面跳转。
Controller中
table delegate
1
2
3
4
5
6
7
8
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
}
override func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) -> NSIndexPath? {
return
indexPath
}
storyboard页面跳转回调
1
2
3
4
5
6
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
destinationCtr = segue.destinationViewController as? FriendViewController
}
通过debug发现prepareForSegue:调用时机在willSelect 和didSelect之间,所以我们可以选择在willSelect方法中获取值,然后在prepareForSegue中传到下个界面,或者在prepareForSegue中获取到下个界面的controller,然后在didSelect中将选中的值赋给controller
0 0
- Storyboard使用TableView进行页面跳转传值
- 利用storyboard进行页面跳转与传值
- storyboard 页面传值跳转
- 使用Storyboard进行界面跳转及传值
- 使用Storyboard跳转和页面间的传值
- tableView点击Cell跳转传值(segue,storyBoard传值)
- Storyboard进行界面跳转及传值
- 使用storyboard实现页面跳转
- Xcode6 StoryBoard页面跳转和传值
- Xcode6 StoryBoard页面跳转和传值
- iOS开发-使用Storyboard进行界面跳转及传值
- IOS开发-使用Storyboard进行界面跳转及传值
- iOS开发-使用Storyboard进行界面跳转及传值
- iOS开发-使用Storyboard进行界面跳转及传值
- iOS开发-使用Storyboard进行界面跳转及传值
- IOS开发-使用Storyboard进行界面跳转及传值
- IOS开发-使用Storyboard进行界面跳转及传值
- iOS开发-使用Storyboard进行界面跳转及传值
- 第七周项目1—建立顺序环形队列算法库
- 网易游戏笔试2015—字符串压缩
- 第6周、项目4—数制转换
- 第七周项目2-建立链队算法库
- PL\SQL连接Oracle 10g数据库 常见问题
- Storyboard使用TableView进行页面跳转传值
- 第四周项目3—单链表应用(1)
- 第七周项目1建立顺序环形队列算法库
- struts2拦截器的三种配置方法
- (第四周项目4)建设双链表算法库
- IOS网络编程简单介绍
- jquery filter() find()
- Linux上怎么定时执行C++程序
- - (void)applicationWillTerminate:(UIApplication *)application;为什么不会被调用。