** В ** 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 версии ,
Я стараюсь каждый метод, но страница не меняется при выборе ряда. Есть идеи ?
EDIT:
я изменить код, как этот
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>.
EDIT:
'self.navigationController' ноль? – Larme
Да, вы права self.navigationController - это ноль, как я могу исправить? Я редактирую вопрос – vayfi
вы shoud добавьте контроллер AgendaListPage в контроллер навигации программно, когда вы создаете объект AgendaListPage. например 'AgendaListPage * obj = [[AgendaListPage alloc] init]; UINavigationController * navController = [UINavigationController alloc] initWithRootViewController: obj; ' –