标签:
//点击cell跳转时触发
// In a storyboard-based application, you will often want to do a little preparation before navigation
在使用storyBoard时进行传值是的操作.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
//得到目的视图
DetailViewController * detailVC = [segue destinationViewController];
//得到点击的cell
ContactTableViewCell * cell = sender;
//得到索引值
NSIndexPath * indexPath = [self.tableView indexPathForCell:cell];
//传值.
detailVC.string = [self.MArray objectAtIndex:indexPath.row];
__weak ContactTableViewCell *cellTwo = cell;
__weak DetailViewController *detailTwoVC = detailVC;
[detailTwoVC showTFStringBlock:^(NSString *str) {
//给cell赋值.
cellTwo.aLabel.text = str;
//在MRC下用__BLock解决循环引用问题防止引用计数加1, 在ARC环境下用__weak解决循环引用问题,防止cell,detailVC所持有的对象引用计数加一.
detailTwoVC.view.backgroundColor = [UIColor redColor];
}];
}
标签:
原文地址:http://www.cnblogs.com/jfhn/p/4442939.html