ios - Section header persists even after removing section data and reloading UICollectionView -


after removing last item in section, goal remove entire section, including header, uicollectionview. unfortunately, section header persists though there no section in underlying data model.

refreshing view -- popping navigation stack , navigating view -- correctly shows uicollectionview section header removed.

in test case, there 1 section uicollectionview should become blank after removing final item.

suggestions?

func numberofsectionsincollectionview(collectionview: uicollectionview) -> int {     print("# sections: \(user.getsections().count)")     return user.getsections().count }      // delete item     let indexpath = view.indexpathsforselecteditems()![0]     let section = user.getsections()[indexpath.section]     user.removeitemat(section, index: indexpath.row)     view.deleteitemsatindexpaths([indexpath])      // update 1 section or entire view     if (section.getnumitems() > 0) {         view.reloadsections(nsindexset(index: indexpath.section))     } else {         view.deletesections(nsindexset(index: indexpath.section))         view.reloadsections(nsindexset(index: indexpath.section))         view.reloaddata()     } 

when want remove section uicollectionview must: 1. update model, 2. call deletesections(sections: nsindexset) on collection view 3. ensure numberofsectionsincollectionview returns appropriate number of sections updated model.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -