外观代理层数 [英] Appearance Proxies & Layers

查看:60
本文介绍了外观代理层数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用iOS 5外观代理来重构在图层上设置属性的代码?

Is it possible to use iOS 5 appearance proxies to refactor code that sets properties on layers?

_button.layer.cornerRadius = 5.0f;
_button.layer.borderWidth = 1.0f;
_button.layer.borderColor = [[UIColor blackColor] CGColor];
_button.layer.masksToBounds = YES;

推荐答案

不是.苹果说:

要支持外观自定义,类必须符合 UIAppearanceContainer协议和相关的访问器方法必须是 标记有UI_APPEARANCE_SELECTOR.

To support appearance customization, a class must conform to the UIAppearanceContainer protocol and relevant accessor methods must be marked with UI_APPEARANCE_SELECTOR.

http://developer.apple .com/library/ios/#documentation/uikit/reference/UIAppearance_Protocol/Reference/Reference.html

UIButton没有.

And UIButton does not.

而且UIButton没有标记有UI_APPEARANCE_SELECTOR的任何方法.

And UIButton does not have any methods marked with UI_APPEARANCE_SELECTOR.

这篇关于外观代理层数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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