[问题] UITableView及Cell的问题(已解)

楼主: satou20444 (希当普利斯)   2016-02-15 15:06:12
最近小弟在学习 Objective-C 遇上了一些小问题
已经在 MainStoryBoard 新增两个 Cell (姑且把ID设定为 cellOne 及 cellTwo)
然后在 numberOfRowsInSection 中设定第一个 section return 4
这样第一个 section 就会跑 4 次 cell 到这边的理解应该正确吧 ?
想问的是能够上面两个 row 使用 cellOne 下面两个 row 使用 cellTwo 吗 ?
还是一个 section 只能使用一种 cell 呢 ?
烦请各位解答了 m(_ _)m
作者: appleway (苹果爱天空)   2016-02-15 15:26:00
yes, you can do it.
作者: www16852 (LM31)   2016-02-15 16:39:00
建立两个cell class?然后在data source的cellForItemAtIndexPath加上if let cell as? cellTwo{}这样吧阿 我是用swift 你在看看@@
作者: LFimi   2016-02-15 18:25:00
在cellForRowAtIndexPath判断条件 return 不同的 cell你举的例子大概就是 if (indexPath.row <=1) ... else ...

Links booklink

Contact Us: admin [ a t ] ucptt.com