You should not set the height in the cellForRowAtIndexPath method. there is another UITableViewDatasource method called tableView: heightForRowAtIndexPath: which you must implement to return the height of the cell. Be careful using this; You should not get a cell along this pointer path in this method; if you do, you will build an infinite recursive loop.
Edit: be clear; you need to calculate the height of the cell based solely on it, and not on the cell itself.
In addition, in your code where you create the cell, you can simply pass the frame argument to CGRectZero; in the table view, the cell frame itself will be calculated if you do this (as well as explicit transmission in the frame is deprecated in OS 3.0, if I remember correctly).
source share