cell的控制器ViewController
從cell要跳轉的控制器ViewController2
在cell.h
#import "ViewController.h"
@property (nonatomic, strong) ViewController* mainVC;
cell.m
//點擊按鈕觸發(fā)的方法里
{
ViewController2 *vc2 = [[ViewController2 alloc]initWithNibName:@"ViewController2" bundle:nil];;
[self.mainVC.navigationController pushViewController:vc2 animated:YES];
}
在ViewController.m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
Cell.mainCon = self;
}
寫的很詳細了
在cell文件里 self代表的是cell本身 并不是cell所在的vc
我們要把cell所在的VC的navigationController傳到cell里? .