Checklist inserting date picker row

I’ve been messing around with the Checklist tutorial app and have run into a strange issue that I could use some assistance with. Here is what I attempted to do. I wanted to add a few more fields to the data model, therefore I needed to modify the UI to enter more data.

I inserted 2 more rows in the first section, and then inserted another row after the date picker row in the section section. I made the appropriate modifications to the tableview delegate and datasource to still be able to support the dynamic inserting of the date picker.

When I ran the program on the iPhone 6 Plus and the iPhone 6 simulator it works exactly how I would expect it to work. However, running it on a device with a smaller screen produces an error when I click on the data picker, and then try to scroll the screen down to the rows below the date picker. It gives me an NSRangeException beyond bounds errors.

It seems to me that because the tableview is off screen, the tableview datasource and delegate are ignoring the rest of the static rows therefore causing a crash when I try to scroll to them.

Any thoughts on how I could resolve this?

Thanks,
-Grant

It’s hard to say without seeing the actual code and the full error message. But it’s likely indeed that it happens because part of the table view is off screen. It may be something simple, but it may also be something tricky since you’re messing with the data source of a static table – something that is a little naughty. :wink:

Just to close this out, I fixed it by no longer inserting new rows to the table data model, but instead I initialize the row with a height of 0, and then change the row height when I need to access it.

Works great now!