mazz0 mazz0 - 5 months ago 36
Objective-C Question

UITableView - how do I hide the edit button?

I've created a master detail app using the template in Xcode. When I did the Apple ToDoList tutorial where you start with an ordinary app and add the second view yourself I added the plus and done buttons, but this template seems to include them automatically, except that I don't see them in interface builder, only when I run the app. I don't want to have an "edit" button on the top left (although I do want users to be able to swipe to delete items).

So, my question is twofold:


  1. Why does the Master Detail app template include edit and + buttons
    which don't show up in the storyboard (see screenshots) and

  2. How do I get rid of that Edit button (while leaving the
    swipe-to-delete
    functionality)?



http://www.mazz0.com/images/xcode/masterdetaileditbutton/storyboard.png
http://www.mazz0.com/images/xcode/masterdetaileditbutton/app.png

Answer

You can remove it easily with:

self.navigationItem.rightBarButtonItem = nil;
Comments