Add cell to bottom of UITableView in iOS

后端 未结 2 1754
生来不讨喜
生来不讨喜 2020-12-31 16:58

I am using xcode 4.2 with storyboard to create an iphone app.

When I press the edit button in the top right corner I would like to have the options to delete the exi

2条回答
  •  旧时难觅i
    2020-12-31 17:40

    This tutorial is worth a read and should help you. It shows how to setup an 'Add new row' UITableView row at the bottom of a UITableView, but you should be able to make this appear at the top of your UITableView within your implementation of:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    

    e.g.

    if(self.editing && indexPath.row == 1)
    {
        cell.text = @"Insert new row";
        ...
    

    Hope this helps!

提交回复
热议问题