1
所以,我有問題是,集合視圖,這取決於我在用模擬器它顯示在任一個設置3(iPhone 5)列或者在另一個4列(iPhone 6)。無論屏幕有多大或多小,我都希望採集視圖始終顯示4列。以下是我目前使用的一些代碼:迅速集合視圖縮放問題
override func viewDidLoad() {
super.viewDidLoad()
let screenWidth = UIScreen.mainScreen().bounds.size.width
let screenHeight = UIScreen.mainScreen().bounds.size.height
let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
layout.sectionInset = UIEdgeInsets(top: 20, left: 10, bottom: 10, right: 10)
layout.itemSize = CGSize(width: 100, height: 80)
collview1 = UICollectionView(frame: CGRectMake(0, 0, screenWidth, screenHeight), collectionViewLayout: layout)
[collview1.reloadData];
}