Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>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.</p> <p>If this is not the case, then you have two options:</p> <ol> <li>Create a class that inherits the UITableViewCell and every view you want in it programmatically, forgetting Interface Builder.</li> <li>Add a new iPhone View <strong>with Controller</strong>, replace the view in there and treat it like you did. Except for the fact that you will have to connect your cell with an outlet in the File's Owner. So when you instantiate that controller, all your cell's subviews will be ok.</li> </ol> <p>It is not an overkill, or at least, Apple recommends it: <a href="http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html#//apple_ref/doc/uid/TP40007451-CH7-SW1" rel="nofollow">click and go to the "Loading Custom Table-View Cells From Nib Files" paragraph</a></p> <p>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 <code>LoadNib</code> anything. Just do this inside the GetCell override in your table's source:</p> <pre><code>using (CellController controller = new CellController()) { cell = (CustomCell)controller.View; } </code></pre> <p>Maybe even declare an extra outlet inside the <code>CellController</code> object to avoid casting from UIView.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload