UICollectionViewController
ユーザーがiPadを横向きにするためにiPadを回転させたときにロードする があります。私が抱えている問題は、私UICollectionViewCell
の s がまだ縦向きであるかのようにロードされていることです。UICollectionViewController
Interface Builder 内で を横向きに設定し、と呼んだカスタム セル クラスを使用していCollectionViewCell
ます。各セルには、画像とラベルのみが含まれます。
Interface Builder またはコードで行うべきことはありますか? を使ってみCGAffineTransformationMakeRotation
ましたが、だめでした。他の誰かが以前にこれに遭遇した場合、私は非常に感謝しています! どうもありがとう!
参照用のコードの一部を次に示します。
-(void)viewDidLoad
{
self.collectionView.dataSource = self;
self.collectionView.delegate = self;
}
- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section
{
return listArray.count;
}
- (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView
{
return 1;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
CollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"devices" forIndexPath:indexPath];
cell.statusImage.image=[UIImage imageNamed:@"Default.png"];
cell.name.text=@"HEY !!!!!";
return cell;
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
return CGSizeMake(320, 420);
}
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
return UIEdgeInsetsMake(50, 20, 50, 20);
}