I want to be able to design my own UITableViewCell in IB. But I keep getting a null ref exception when trying to access the label I defined in IB.
Here\'s what I\'m
First of all, it is a matter of design. If your table view always loads a specific number of cells with static content, like in a "Settings" view, create a custom cell for every row you want and connect each one with an outlet.
If this is not the case, then you have two options:
It is not an overkill, or at least, Apple recommends it: click and go to the "Loading Custom Table-View Cells From Nib Files" paragraph
PS: Just had a similar situation and this is the way I've done it. In MonoTouch, for this example, you do not have to LoadNib
anything. Just do this inside the GetCell override in your table's source:
using (CellController controller = new CellController())
{
cell = (CustomCell)controller.View;
}
Maybe even declare an extra outlet inside the CellController
object to avoid casting from UIView.