开发者

showing toolbar buttons on a navigation controller

hi i know i'm missing something because it seems pretty easy all over the web. I'm adding buttons to my toolbar,

the toolbar is showing. but without any buttons.

this is my code :

    - (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"secondPage";
    UIBarButtonItem *deleteAllItem = [[[UIBarButtonItem alloc] initWithTitle:@"Delete All"
                                                                       style:UIBarButtonItemStyleBordered   
                                                                      target:self
                                                                      action:@selector(deleteAllAction:)] autorelease];


开发者_如何学编程    UIBarButtonItem *searchNearbyItem = [[[UIBarButtonItem alloc] initWithTitle:@"Search Nearby"
                                                                          style:UIBarButtonItemStyleBordered
                                                                         target:self
                                                                         action:@selector(searchNearbyAction:)] autorelease];

    [self.navigationController setToolbarHidden:NO];
    self.toolbarItems = [NSArray arrayWithObjects: 
                      deleteAllItem,
                      searchNearbyItem,
                      nil];

} 

Thank you for your help


Have you tried setting the items via:

- (void)setItems:(NSArray *)items animated:(BOOL)animated

Note: Be sure to set this on your view controller, do not set it on the UIToolbar instance directly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜