- 首先集體做的是push 操作.
- 先將跳轉(zhuǎn)的目標(biāo)類 以類名的字符串格式存儲(chǔ)在一個(gè)數(shù)組中
@property (nonatomic,strong) NSArray *dataSourceArray;
_dataSourceArray = @[@"LineVC",@"SlipLineVC",@"CandleLineVC",@"TimeLineVC"];
- 在didselected方法中 根據(jù)下標(biāo)indexPath.row 獲取對(duì)應(yīng)角標(biāo)的 類名字符串
- 獲取類名字符串對(duì)應(yīng)的類
- 創(chuàng)建 實(shí)例對(duì)象
- push操作
NSString *vcName = _dataSourceArray[indexPath.row];
Class class = NSClassFromString(vcName);
UIViewController *vc = [[class alloc] init];
[self.navigationController pushViewController:vc animated:YES];
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者