セルフサイジングテーブルビュー内にコレクションビューがあります。ユーザーがコレクションビューをタップすると、別のビューが表示されます。iOS 'NSInternalInconsistencyException'、理由: 'UICollectionViewFlowLayout内部エラー
私はまだそのビューを縦向きに表示できます。しかし私が景色に回転すると、私はこのエラーが発生し、クラッシュします。どうすればいいですか?
2017年1月23日16:52:16.448417 SWEETミニ[1638:647130]で*アサーション 失敗 - [_ UIFlowLayoutSection computeLayoutInRect:forSection:無効:invalidationContext:]、 /BuildRoot /ライブラリ/キャッシュ/com.apple.xbs/Sources/UIKit/UIKit-3600.6.22/UIFlowLayoutSupport.m:823 2017-01-23 16:52:16.451537 SWEET Mini [1638:647130] *キャッチされていない例外のためアプリを終了する ' NSInternalInconsistencyException '、理由: ' UICollectionViewFlowLayout内部エラー '
このような別のビューを表示します。
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
browser.zoomPhotosToFill = NO;
[browser setCurrentPhotoIndex:(indexPath.row)];
browser.enableSwipeToDismiss = YES;
UINavigationController *browseNav = [[UINavigationController alloc] initWithRootViewController:browser];
if ([[AppDelegate instance].window.rootViewController isKindOfClass:[UINavigationController class]])
{
UINavigationController *nav = (UINavigationController *) [AppDelegate instance].window.rootViewController;
[nav presentViewController:browseNav animated:YES completion:nil];
}
else if ([[AppDelegate instance].window.rootViewController isKindOfClass:[UITabBarController class]]) {
UITabBarController *tab = (UITabBarController *) [AppDelegate instance].window.rootViewController;
[tab presentViewController:browseNav animated:YES completion:nil];
}
}
ビュー階層が壊れている可能性がありますか?なぜあなたは[self presentViewController:browseNav animated:YES completion:nil]を使わないのですか?別のVCを提示する? –
coz私はNSObjectでそのコードを書いており、それはuiviewcontrollerからは遠いです。 (私はまだデリゲートでプッシュできます) –
デリゲートで試しましたか?問題はまだ発生しますか? –