简体   繁体   中英

Tableview with UICollectionView inside scroll not smoothly

I have implemented this UI model:

tableview that have for all rows one collectionview

I have a problem. When i scroll the tableview the scroll isn't smoothly. The profiling tool told me that the time gas been allocated for the collectionview reuse inside tableview cell. Any solution? I am going crazy :(

refs to: Independent scrolling for each section of a UICollectionView?

I have found with time profiler that:

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

When i access to an NSObject of kind Catalog too much time are spent for this assignement:

    cell.catalogTitle = test

I cannot understand.

The NSObject is:

class Catalog: NSObject {
   var contentId = ""
   var type = ""
   var title = ""
   var sequence = ""
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM