0

在 HTML + CSS 中,如果我想创建三个外观相同的按钮,我可以在 div 中添加一个类,并在 CSS 中定义外观。这样当我想再次更新外观时,我只能更新CSS。

在 iOS 中,我通常在 View Controller 中初始化并定义 UI Control 的外观。如何将 UI 外观定制与 View Controller 分开?有没有关于它的最佳实践、设计模式或框架?

4

1 回答 1

1

我一直在initialize应用程序委托的方法中进行所有 UIAppearance 自定义。你可以使用appearanceWhenContainedIn:方法来做一个 div 和 CSS 的等价物。

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], 
     [UIPopoverController class], nil] setTintColor:myPopoverNavBarColor];
于 2012-11-26T22:31:23.853 回答