背景
我正在截取 viewController 的屏幕截图并将其呈现在 collectionViewCell 中。collectionViewCell 的布局是水平的,但是当我选择一个视图然后旋转设备然后再回到 collectionView 时,布局是垂直的。
调试:我在代码中放置了一个断点,在调试区域中,我尝试检查变量的输出,这就是下面的警告开始出现的地方。
**Warning:**
error: property 'modalPresentationStyle' declared with incompatible types in different translation units ('UIModalPresentationStyle' vs. 'UIModalPresentationStyle')
error: instance method 'modalPresentationStyle' has incompatible result types in different translation units ('UIModalPresentationStyle' vs. 'UIModalPresentationStyle')
error: property 'modalPresentationStyle' declared with incompatible types in different translation units ('UIModalPresentationStyle' vs. 'UIModalPresentationStyle')
error: instance method 'modalPresentationStyle' has incompatible result types in different translation units ('UIModalPresentationStyle' vs. 'UIModalPresentationStyle')
error: property 'modalPresentationStyle' declared with incompatible types in different translation units ('UIModalPresentationStyle' vs. 'UIModalPresentationStyle')
error: instance method 'modalPresentationStyle' has incompatible result types in different translation units ('UIModalPresentationStyle' vs. 'UIModalPresentationStyle')
note: declared here with type 'UIModalPresentationStyle'
note: instance method 'modalPresentationStyle' also declared here
note: declared here with type 'UIModalPresentationStyle'
note: declared here with type 'UIModalPresentationStyle'
note: instance method 'modalPresentationStyle' also declared here
note: declared here with type 'UIModalPresentationStyle'
note: declared here with type 'UIModalPresentationStyle'
note: instance method 'modalPresentationStyle' also declared here
note: declared here with type 'UIModalPresentationStyle'
error: 6 errors parsing expression
我在用着 :-
- Xcode 版本:7.1
- iOS:9.1
注意 - 我在 Xcode 6.4 上使用iOS8运行的代码相同,它运行时没有出现故障/警告。此外,我能够在调试区域中找到变量的值。
更多信息 :-
断点 -我把它放在下面的方法中
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
UIViewController *viewController = (UIViewController *)_tabControllers[(NSUInteger)indexPath.row];
/* Trying to debug above viewController in debug area */
/* Some code is here also but of no use */
cell.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
return cell;
}
在调试区域中触发的命令 -
po viewController
预期结果 -
像往常一样具有像框架一样的细节的 viewController 的值。
实际结果 -
上面提到的警告。
我正在尝试调试的内容-
在 iOS 9 中,collectionView 单元格的布局会自动更改(在旋转后出现在另一个下方),而在 iOS 8 中的其他布局(水平视图)是完美的。
提前致谢。