我試圖創建一個視圖集合與多個單元格。UICollectionView水平單元格
第一個單元格必須包含時間線。
正如您在圖像中看到的,無法在橫向上打印時間線。
如何水平打印此單元格?
我的代碼:
class ViewController: UIViewController, UICollectionViewDataSource,UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
var year = 2000
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 200
}
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
return CGSize(width: 97, height: 33)
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
var cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as MyViewCell
cell.textView.text = "\(year)";
year++;
return cell
}
}
所有細胞水平? – 2014-12-05 11:14:04
不是。共三個單元格,只有兩個水平和一個垂直。在這個鏈接中:你可以看到我在做什麼:http://code4app.net/ios/Static-column-table/50fe649d6803fa7b65000001 – uynva 2014-12-05 11:21:02
減少單元格的大小,這樣兩個單元格將出現在水平寬度中,並在部分中分配三個單元格。 – 2014-12-05 11:23:45