Bunu denemek gerekir:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)[self.collectionView collectionViewLayout];
if ((toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) || (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft)){
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
}
else{
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
}
}
yılında Hızlı:
override func willRotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {
var layout = self.collectionView.collectionViewLayout as! UICollectionViewFlowLayout
if ((toInterfaceOrientation == UIInterfaceOrientation.LandscapeLeft) || (toInterfaceOrientation == UIInterfaceOrientation.LandscapeRight)){
layout.scrollDirection = UICollectionViewScrollDirection.Vertical
}
else{
layout.scrollDirection = UICollectionViewScrollDirection.Horizontal
}
}
Bu kodu viewdidload() içinde bildirmek için; – user3040186
http://adoptioncurve.net/archives/2012/09/a-simple-uicollectionview-tutorial/ – user3040186
Bununla ilgili sorunları görüyorum; burada readyLayout aralıklı olarak yeterince erken çağrılmıyor veya çok geç çağrılıyor. Sonuçlar 3 şeyden biri: 1) horizontalSizeClass henüz değişmedi ve kaydırma yönü yanlış ayarlanmış 2) scrollingDirection doğru ayarlandı ama çok geç ve etkili olmaz ve 3) her şey düzgün bir şekilde ve kaydırma yönünde aslında istenen şekilde etkili olur. Görünüşe göre belki de Apple, düzen yerine görünüm denetleyicisinde yönetilecek yönü kaydırmayı amaçlamaktadır. – BTRUE