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

查看:62
本文介绍了以编程方式更改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天全站免登陆