editing the UItableview using barbutton item
i am trying to edit the UItableview . what i am doing is trying to diplay a leftbarButton on my navigation bar
i wrote this code in my viewdidload
[self.navigationItem setLeftBarButtonItem:self.editButtonItem];
but its not showing any button on my navigation bar :S
P.S : My currentview is subview of tabbarcontroller and i am using UItableView and UInavigationbar in my开发者_JAVA百科 interfacebuilder .
can any one help me
thanks in advance
regards
Edit : I am not using UItableViewController
i cant get this work if i dont use UItableViewController .
UITabBarController and UINavigationController work as container, they can contain other UIViewController's instances inside. So, you can use UITabBarController to contain sub view which are UITableViewController's subclasses.
You can read the sample codes of TheElements and LocateMe. They use UITabBarController to manage other UIViewController instances. Like TheElements, it manages UITableViewController instances by UITabBarController.
And then, you can display the edit button of UITableViewController.
Or, you can use the method of UITableView to enter the editing mode or leave the editing mode.
- (void)setEditing:(BOOL)editing animated:(BOOL)animate;
Where have you placed the above code in? It should be in the viewDidLoad of the tableView implementation file
Ideally, init the navigation controller with your tableview controller. Then place the above code you've written inside the viewDidLoad of the tableViewController. It should work normally as expected.
精彩评论