Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One approach, assuming you're using a Storyboard to create view and set properties:</p> <p>In your UITableView object properties set "content" property to "Dynamic Prototypes". </p> <p>Then add an additional Table View Cell to your table from the storyboard editor's UI object list (just like adding another label or button or whatever).</p> <p>You should now have two TableViewCell objects in your table view. If not, add another. </p> <p>Give both table view cell objects different identifiers (that is, set property "identifier" for each to different strings).</p> <p>Set up the first cell to display your normal content.</p> <p>Set up the second cell to display your unique "last row" layout.</p> <p>In your code, in cellForRowAtIndexPath return the "main" cell for most rows, but the alternate cell for the last row:</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // rows are 0-indexed if (indexPath.row == myDataSource.count) { NSString *CellIdentifier = @"AlternateCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; // populate contents... } else { NSString *CellIdentifier = @"NormalRow"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; // populate contents... } } </code></pre> <p>For that to work, you'll have to tell the TableView that there's one more row than you have actual data for:</p> <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return myDataSource.count +1; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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