开发者

Keep buttons of a UIToolbar throughout views

开发者 https://www.devze.com 2023-04-04 22:35 出处:网络
In the first navigation controller I\'ve added four buttons to an U开发者_Python百科IToolbar. These four buttons have also four different actions.

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 UIViewas a subView (using [self.view addSubview:yourcustomViewObject.view];) at the proper location on the screen(its bottom).

0

精彩评论

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

关注公众号