Set the default font style, color, and size for an

2019-05-10 11:02发布

The app I'm working on has a particular color scheme, so I was wondering if it is possible to set a "default" background color, text color, and font size so that every time I create a new view, or label in Interface Builder I don't have to change all of these parameters.

2条回答
时光不老,我们不散
2楼-- · 2019-05-10 11:26

As of iOS 5, there is the UIAppearance protocol that all of the standard UI elements implement. Using the "Appearance proxy" you can set the appearance for ALL objects of that type in a given application. More information can be found in the incredibly helpful and informative WWDC '12 session on "Advanced Appearance Customization on iOS"

查看更多
姐就是有狂的资本
3楼-- · 2019-05-10 11:44

How about just creating a DanFViewController (subclassed from UIViewController) that already has the specific background color, text color, font size, etc. you need and then derive all your app's custom views from that?

That's what I do in my own apps where clients are expecting a certain look & feel for all the views.

查看更多
登录 后发表回答