Hi I have a tableView inside my view. But I want the edit in the navigation bar to work for the tableView. Could you please tell me how to do this?
I have the navigation bar set up for the main view and have the tableView set up as well.
I made a create navigation bar method:
- (UINavigationBar *)createNavigationBar
{
UINavigationItem *title = [[UINavigationItem alloc] initWithTitle:@"Task Manager"];
UINavigationBar *new = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:nil];
title.leftBarButtonItem = addButton;
[new pushNavigationItem:title animated:YES];
UIColor *color = UIColorFromRGB(0xff8c00); // Dark orange
new.tintColor = color;
return new;
}
I have the
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
set up as well.
I basically need the red circles to appear for the sub-tableView when i tap the edit button in main navigation bar.
I’m sorry if I wasn’t clear. Please ask me if you need any clarification.
Thanks! 🙂
You should have a BOOL variable to store the current editing state and a function (
addTarget) to the edit button which will put the table in edit mode based on this variable, like this :You should rename that variable named
newto something else !