I'm working on an app and I'm running into some problems on how to work out this functionality. I've pieced a crude wireframe together:
Essentially, if no data exists in the section, I have a custom 'Empty data' cell display. In the numberOfRowsInSection
delegate call, I had a simple test where if my array count is 0, return 1. I assume its hacky so if there is a better approach please let me know.
My problem is I also have a custom 'Input' cell that I want to appear inline in the section, replacing the 'Empty' cell. I was able to piece that together by adding a string to my data array, then calling the tableView insertRowsAtIndexPaths
with some very crazy conditionals in my tableView cellForRowAtIndexPath:
method.
What I can't get working is if a user cancels, rather than saving, I want the 'Input' cell to disappear and the 'Empty' cell to return. I can't just remove my custom string from my data array because tableView throws an error that my datasource count wasn't expected because I used the removeRowsAtIndexPaths to remove one row.
Any guidance would be greatly appreciated.
the better approch would be dynamically hide the tableview and add a placeholderview -- I wouldnt 'misuse' the table view for that
the 'input view' and 'the empty cell' would be independent of a table
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.