以编程方式更改UIButton类型 [英] Change UIButton type programatically

查看:121
本文介绍了以编程方式更改UIButton类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用IB制作的UIButton,它被设置为Rounded Rect。有一点,我想把类型改为自定义的代码,是可能吗?

I have an UIButton made with IB, it is set to "Rounded Rect". At one point, I'd like to change the type to "Custom" in the code, is that possible ? I saw the type can be set at creation, but did not see if it was possible to change it later on.

推荐答案

如果在创建时可以设置类型,我没有错,不同的按钮类型由不同的(私有)UIButton的子类表示。这就是为什么您只能在创建时设置类型,而不能设置。

If I'm not mistaken, different button types are represented by different (private) subclasses of UIButton. That's why you can only set type at creation time but not after.

这篇关于以编程方式更改UIButton类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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