iPhone : How to display a common button on my all

2019-09-15 19:13发布

I want to put button which should be displayed on my all view.

The way we are implementing Tab Bar. I want to implement buttons.

Where should I put that button ? And where should I give its functionality ?

2条回答
地球回转人心会变
2楼-- · 2019-09-15 19:54

How many views are we talking about?

If we're just talking about a few views, it probably makes sense to just include similar-looking buttons on each view. If we're talking about many views, then you'll probably want to look at other options.

One solution would be to create a subclass of UIViewController that sets up the button and contains the button's action. The controllers for each view would then be subclasses of that class, so that each inherits the button and action.

查看更多
够拽才男人
3楼-- · 2019-09-15 19:57

Create your button on main window (i.e. UIWindow) and keep front always after when you loading view.

查看更多
登录 后发表回答