** **在Discover.mpushViewController不是的.xib文件工作
AgendaListPage *controller1 = [[AgendaListPage alloc]initWithNibName:@"AgendaListPage" bundle:nil];
controller1.title = @"Page1";
MissedDataListPage *controller2 = [[MissedDataListPage alloc]initWithNibName:@"MissedDataListPage" bundle:nil];
controller2.title = @"Page2";
** **在AgendaListPage.m
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (tableView == self.tableView){
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
HastagScreenTablePage *myControllerHastag = [storyboard instantiateViewControllerWithIdentifier:@"hastagScreen"];
myControllerHastag.detailModalForHastag = @[[getTopHastagObject[indexPath.row] gethastagName]];
[self.navigationController pushViewController: myControllerHastag animated:YES];
}
}
我用https://github.com/uacaps/PageMenu API的OBJ-C版本。
我想盡一切方法,但選擇行時不改變頁面。任何想法 ?
編輯:
我改變這樣
HastagScreenTablePage *myControllerHastag = [self.storyboard instantiateViewControllerWithIdentifier:@"hastagScreen"];
myControllerHastag.detailModalForHastag = @[[getTopHastagObject[indexPath.row] gethastagName]];
FirstNavControllerPage *navigationController = [[FirstNavControllerPage alloc] initWithRootViewController:myControllerHastag];
[self.navigationController pushViewController: navigationController animated:YES];
FirstNavControllerPage代碼是一個UINavigationController
現在的錯誤:Application tried to push a nil view controller on target <FirstNavControllerPage: 0x13659d5c0>.
編輯:
'self.navigationController'零? – Larme
是的,你是權利self.navigationController是零我該如何解決?我編輯問題 – vayfi
當您創建AgendaListPage的對象時,您應該以編程方式將AgendaListPage控制器添加到導航控制器。例如'AgendaListPage * obj = [[AgendaListPage alloc] init]; 的UINavigationController * navController = [UINavigationController的頁頭] initWithRootViewController:OBJ;」 –