Ios 从UICollectionViewController推送到UINavigationController时崩溃
我的应用程序目前有问题。 我有一个UICollectionViewController嵌入在一个NavigationController嵌入在一个TabBarController中 基本上,我有一个用户集合,当我单击它时,我想转到详细视图 当我尝试执行此过程时,发生崩溃,我收到消息:“***由于未捕获的异常“NSInvalidArgumentException”终止应用程序,原因:“不支持推送导航控制器”” 我的故事板结构如下所示: UIAbbarController->UINavigationController->UICollectionViewController->UiViewControllerIos 从UICollectionViewController推送到UINavigationController时崩溃,ios,objective-c,uinavigationcontroller,Ios,Objective C,Uinavigationcontroller,我的应用程序目前有问题。 我有一个UICollectionViewController嵌入在一个NavigationController嵌入在一个TabBarController中 基本上,我有一个用户集合,当我单击它时,我想转到详细视图 当我尝试执行此过程时,发生崩溃,我收到消息:“***由于未捕获的异常“NSInvalidArgumentException”终止应用程序,原因:“不支持推送导航控制器”” 我的故事板结构如下所示: UIAbbarController->UINavigation
@interface AnnuaireCollectionViewController : UICollectionViewController
@property (strong, nonatomic) NSMutableArray *photos;
@property (strong, nonatomic) NSMutableArray *noms;
@property (strong, nonatomic) NSMutableArray *users;
@property (strong, nonatomic) IBOutlet UICollectionView *collection;
@end
我的preparForSegue方法:
#pragma mark - Prepare for Segue
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
UICollectionViewCell *cell = (UICollectionViewCell *)sender;
NSIndexPath *indexPath = [self.collectionView indexPathForCell:cell];
UserDetailViewController *userDetailViewController = (UserDetailViewController *)segue.destinationViewController;
userDetailViewController.userImage = [UIImage imageNamed:[self.photos objectAtIndex:indexPath.row]];
userDetailViewController.user = [self.users objectAtIndex:indexPath.row];
}
故事板:
我查看了苹果文档上的示例代码,所有内容都很相似,我不明白为什么会出现这个错误
我哪里出错了
谢谢 如果写入“不支持推送导航控制器”,则不要推送它。重放、呈现模式等。有很多方法呈现ViewController。问题是Apple示例代码使用了推送方法(因此我知道这是可能的),我需要它回到我需要的方式。@Kawada,我非常确定,在这个示例代码中,push not
UINavigationController
我从苹果文档网站下载了以下代码:@Kawada,pushDetailViewController
子类来自UIViewController
,而不是来自UINavigationController
,正如我在第一条评论中写到的。我认为你的UserDetailViewController
是从UINavigationController
中派生出来的。正是这样,我觉得很丢脸。谢谢!