バックグラウンド
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
注 - iOS8を搭載した Xcode 6.4 で実行したのと同じコードで、不具合や警告なしで実行されています。また、デバッグ領域で変数の値を見つけることができました。
より詳しい情報 :-
ブレークポイント -以下のメソッドに入れました
- (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の値。
実結果 -
上記の警告。
私がデバッグしようとしているもの -
collectionView セルのレイアウトは、iOS 8 のレイアウト (水平ビュー) が最適であった iOS 9 では自動的に変更されます (回転後に次々と下に表示されます)。
前もって感謝します。