开发者

can I have a UIButton with UIWebView contents?

开发者 https://www.devze.com 2023-02-05 10:00 出处:网络
I\'d like to have buttons that have the text f开发者_开发技巧ormatting capabilities of a UIWebView. Is this possible to do easily by subclassing UIButton, or am I better off with a different approach?

I'd like to have buttons that have the text f开发者_开发技巧ormatting capabilities of a UIWebView. Is this possible to do easily by subclassing UIButton, or am I better off with a different approach? If at all possible, I'd rather be able to benefit from the functionality in UIButton rather than subclass UIControl and reimplement button functionality.


UIButton is a so called class cluster. This means that once you've instantiated a button, you're not getting an instance of UIButton but of some private internal class (see also this SO question). So the best way really is to subclass from UIControl, I'm afraid. Search StackOverflow for UIButton subclassing, there are already a lot of questions related to it that might explain this in more detail.

Edit: You can subclass UIButton but it seems to be problematic.

0

精彩评论

暂无评论...
验证码 换一张
取 消