我有一個集合視圖內自我大小tableview。當用戶點擊收藏視圖時,我呈現另一個視圖。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年1月23日16:52:16.451537 SWEET贈送[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];
}
}
也許你的視圖層次被破壞?爲什麼你不使用[自我presentViewController:browseNav動畫:是完成:無];呈現另一個VC? –
因爲我已經寫了NSObject的代碼,它遠離uiviewcontroller。 (我的意思是我仍然可以推委託) –
你有代表試過嗎?問題仍然存在? –