iOS_User
iOS_User

Reputation: 1382

how to show table in editing mode in iphone?

in app i have custom tableview which subclass of uiviewcontroller & i want to show editing in tableview when i show self.navigationItem.rightBarButtonItem = self.editButtonItem; when i clicked on it the tableview doesn't show red minus sign. where i was wrong & what i do for come out from it?

Upvotes: 0

Views: 532

Answers (1)

Ishu
Ishu

Reputation: 12787

You can use self.editButtonItem; only : in case your class is a subclass of UITableViewController sub class .

In case of UIViewController sub class self.editBarButtonItem does not work.

In this case you can use

self.navigationItem.rightBarButtonItem=[[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(edit:)] autorelease];

and in edit method set editing

-(void)edit:(id)sender { myTable.editing=YES; }

Upvotes: 2

Related Questions