我已经实现了这个UI模型:
tableview,包含所有行的一个collectionview
我有问题。滚动桌面视图时滚动不顺畅。分析工具告诉我,已经为tableview单元格中的collectionview重用分配了时间气体。有解决方案吗我疯了:(
参考: Independent scrolling for each section of a UICollectionView?
答案 0 :(得分:0)
我发现时间分析器:
func collectionView(collectionView:UICollectionView,cellForItemAtIndexPath indexPath:NSIndexPath) - > UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(collectionCell, forIndexPath: indexPath) as ItemCollectionCell
var ash = showcaseArray.objectAtIndex(indexPath.section) as? Showcase
var idcat = ash?.id
var catalogs = self.showcaseElements.objectForKey(idcat!) as [Catalog]
var aCatalog: Catalog = catalogs[indexPath.row] as Catalog
var test = aCatalog.title
cell.catalogTitle = test
当我访问类型目录的NSObject时,这个分配花了太多时间:
cell.catalogTitle = test
我无法理解。
NSObject是:
class Catalog: NSObject {
var contentId = ""
var type = ""
var title = ""
var sequence = ""
}