简体   繁体   中英

cellForRowAtIndexPath not called after filter

So I have swift code that creates a list of profiles and allows individuals to filter and sort them as well as click on them. Like an address book. It is set up in a Master/Detail format with the master being the list of people and the detail being the individual. I also have a show segue from master which opens up a separate filter and sort page.

My issue is this: when returning from the filter page numberOfRowsInSection is called but not cellForRowAtIndexPath. I have put breakpoints at cellForRowAtIndexPath and they hit when I open the app but not when I return from the filter screen. Thus, the filter narrows down to the appropriate number of rows, and even the links are correct (if I click on the first filtered row the detail view has the correct profile) but because it is not "refreshing" the content of the master's list with cellForRowAtIndexPath when I return from the filter screen the cells in master do not display correctly.

For example, I have the list: Adam Andrew Alex

I click the filter button, get taken to a new screen, do a text based filter for "Andrew" and return to the master list. It shows Adam

Filtering to the right number of people but still showing the first element from the last list and not refreshing.

Any tips on what I am doing wrong? I can show whatever you want to see of my actual code for numberOfRowsInSection or cellForRowAtIndexPath but not sure how that would be helpful given that the issue is that the latter func is just not being called. Can I force it to fire somehow or is that a hack and is there a structural issue here?

Thanks!

筛选完表格后,您必须调用: tableView.reloadData()此方法触发单元格的cellForRowAtIndexPath

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