添加自定义按钮后,将后退按钮添加回navigationController

时间:2013-07-08 21:44:00

标签: ios objective-c cocoa-touch

我正在尝试实施其中包含navigationcontroller的{​​{1}}。此表视图应该是可编辑的,要向表中添加行,用户应按下屏幕顶部栏上的加号按钮。但是,当我添加uitableview并将其设置在左侧时,后退按钮不会重新出现?我怎么会重新出现?

编辑按钮:

uibarbuttonitem

UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editButtonPressed)]; [[self navigationItem] setRightBarButtonItem:button]; 方法:

editButtonPressed

[_actionList setEditing:TRUE]; UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addAction)]; [[self navigationItem] setLeftBarButtonItem:addButton animated:TRUE]; editButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(editButtonDone)]; [[self navigationItem] setRightBarButtonItem:editButton animated:TRUE]; [self disableButtons]; 方法:

editButtonDone

我是初学者,如果这是愚蠢的话,我很抱歉。

2 个答案:

答案 0 :(得分:1)

离开编辑模式时,请尝试重置左侧栏按钮。

[[self navigationItem] setLeftBarButtonItem:nil animated:YES];

答案 1 :(得分:0)

试试这个:

    [yourNavBar pushNavigationItem:self.navigationItem animated:NO];

希望有所帮助