What you are doing is causing infinite recursion leading to a ... wait for it ... stack overflow!
Inside the heightForRowAtIndexPath:
method you can't ask the table for a cell or the indexPath for a row because those methods need to know the cell's height. So those call result in heightForRowAtIndexPath:
being called. And since you then call the same offending methods again, this goes on until things go boom.
Since your goal is to hide the cells, you should remove the cells from the table using the proper UITableView
method (deleteRowsAtIndexPaths:withRowAnimation:
). Of course you need to update your data model first (to remove the rows).