In the first navigation controller I've added four buttons to an U开发者_Python百科IToolbar. These four buttons have also four different actions.
My problem is when I push a new view controller in the navigation stack the UIToolbar is still visible but the four buttons disappears.
How to keep the buttons and how to keep their actions without rewriting the code to add four buttons and the four actions method in every view where I want the toolbar?
Make a separate class that inherits the UIToolbar
class(in other words, your own custom Toolbar class) and then create and add instances of this new class' objects in subsequent classes at the proper location on the screen(its bottom).
OR
Make a separate class that inherits the UIView
class and add buttons to it that give the same look and feel as the UIToolbar
. Then make instances of this new class' objects and add this object's UIView
as a subView (using [self.view addSubview:yourcustomViewObject.view];
) at the proper location on the screen(its bottom).
精彩评论