IOS学习之路十六(UItableView 通过Prepare for segue 页面传值)
2013-08-21 14:13
639 查看
当你点击一个UITableView 的section 或者cell的时候希望把值传到另一个页面(页面是通过segue跳转的),可以通过prepareforsegure 方法传值
(我的UITableView Controller 添加了NavigationController)
示例代码如下:
原文出处:http://blog.csdn.net/wildcatlele
(我的UITableView Controller 添加了NavigationController)
示例代码如下:
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { UIViewController *controller; if ([segue.destinationViewController isKindOfClass:[UINavigationController class]]) { UINavigationController *navController = (UINavigationController *)segue.destinationViewController; controller = [navController.viewControllers objectAtIndex:0]; } else { controller = segue.destinationViewController; } if ([controller isKindOfClass:[NewsDetailViewController class]]) { NewsDetailViewController *detailController = (NewsDetailViewController *)controller; NSIndexPath *selectIndexPath = [self.mainTableView indexPathForSelectedRow]; //[detailController setDataString:[NSString stringWithFormat:@"%i",selectIndexPath.section]]; [detailController setDataString:[self.dataArray objectAtIndex:selectIndexPath.section]]; } else { NSAssert(NO, @"Unknown segue. All segues must be handled."); } }
原文出处:http://blog.csdn.net/wildcatlele
相关文章推荐
- IOS学习之路十六(UItableView 通过Prepare for segue 页面传值)
- IOS学习之路十七(通过delegate进行页面传值)
- iOS学习之驾照题库(练习页面跳转,传值,UITableView,原生json解析)
- IOS学习之路十四(用TableView做的新闻客户端展示页面)
- IOS学习之路五(代码实现UITableView)
- IOS学习之UiTableView仿个人中心页面,据说学会这个控件就能装逼了(二)
- IOS开发---菜鸟学习之路--(十七)-利用UITableView实现个人信息界面
- IOS学习之路十四(用TableView做的新闻客户端展示页面)
- IOS Swift prepareForSegue 视图页面跳转
- IOS学习之路十七(通过delegate进行页面传值)
- IOS prepareForSegue 多窗口切换学习
- IOS UITableView 方法及属性学习
- (素材源码) 猫猫学IOS(十二)UI之UITableView学习(上)LOL英雄联盟练习
- iOS开发学习笔记——表格4(UITableView)->自定义单元格(UITableViewCll)
- [ios]iOS学习之UITableView(一): 新手篇创建tableView
- IOS开发学习笔记026-UITableView的使用
- iOS客户端学习-UITableView中的分割线/UITableViewCell点击背景不变色
- IOS开发学习笔记027-UITableView 使用模型对象
- IOS学习笔记30—两个ViewController间传值(一)
- iOS学习之UITableView中Cell的操作