我无法在UINavigationController中添加UIBarButtonItem

时间:2010-12-31 13:12:14

标签: cocoa-touch uinavigationcontroller

navigator=[[UINavigationController alloc]initWithRootViewController:contacts];


UIBarButtonItem *nextButton = [[UIBarButtonItem alloc]
       initWithTitle:@"Delete"
       style:UIBarButtonItemStyleBordered
       target:self
       action:@selector(makeCall)];

[[self.navigator navigationItem] setLeftBarButtonItem:nextButton];


[nextButton release];

我无法在UINavigationController中添加UIBarButtonItem,请帮忙

1 个答案:

答案 0 :(得分:3)

在这里说出袖口,也许不是

[[self.navigator navigationItem] setLeftBarButtonItem:nextButton];

使用

self.navigator.navigationBar.items = [NSArray arrayWithObject:nextButton];

做你想做的事。