UIToolbar on each page of UINavigationController

前端 未结 3 625
别跟我提以往
别跟我提以往 2021-02-05 22:17

I have an application which runs on a UINavigationController. Now I would like to add a UIToolbar element to the bottom of each screen. The Toolbar on the bottom should the be c

3条回答
  •  萌比男神i
    2021-02-05 23:07

    UINavigationController already has a toolbar. Just use

    [self.navigationController setToolbarHidden:NO];
    

    in the topmost view controller and

    [self setToolbarItems:items];
    

    in all your view controllers, where items is an NSArray of that view controller's toolbar items.

    EDIT: As for why your solution isn't working: your TOOLBAR_TAG is probably not unique, that's why you're getting another subview. But as I said, you should use the included toolbar anyway.

提交回复
热议问题