设计iOS应用程序的推荐方法是什么? [英] What is the recommended method of styling an iOS app?

查看:128
本文介绍了设计iOS应用程序的推荐方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

建议使用iOS应用程序样式的方法是什么?例如,如果有多个标签或文本视图,如何在一个地方更新字体样式/颜色更新所有其他位置的样式/颜色?

What is the recommended method of styling an iOS app? For example, if there are multiple labels or text views how can updating font style/color at one place update the style/color at all other places?

我知道子分类可能是一种方式......还有其他方法吗?

I know sub classing could be one way... is there any other way?

推荐答案

您可以将标准头文件导入所有控制器,并为样式设置几个常量...示例:

You could import a standard header file into all your controllers with several constants set for styling... example:

Styles.h

#define kFontSize 14
#define kFontFamily @"Helevetica"

控制器

#import "Styles.h" // at the top

myLabel.font = [UIFont fontWithName:kFontFamily size:kFontSize];

我个人认为Interface Builder是最好的造型方式,但这会直接回答你的问题。

I personally think Interface Builder is the best way to style, however this answers your question directly.

这篇关于设计iOS应用程序的推荐方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆