如何在正常状态下设置UIImage并在我的UIButton中设置选定状态的标题?
嗨,我尝试在UIButton的正常状态下设置UIImage,但是当在正常状态下设置UImage时,这会更改处于选定状态的UIButton的标题,从而更改图像的标题。 我在用
myButton setTitle:content forState:UIControlStateSelected
在选定的州。
如何在正常状态下设置UIImage并在我的UIButton中设置选定状态的标题?
PDT:对不起我的英语!
How I can set UIImage in the normal state and set title in the selected state in my UIButton?
Hi, I try to set a UIImage in the normal state of UIButton, but when set an UImage in normal state this change the title of UIButton in the selected state changing the title for the image . I am using
myButton setTitle:content forState:UIControlStateSelected
in the state selected.
How I can set UIImage in the normal state and set title in the selected state in my UIButton?
PDT: sorry for my english!.
最满意答案
检查此代码:
[myButton setTitle:content forState:UIControlStateSelected]; [myButton setImage:nil forState:UIControlStateSelected]; [myButton setImage:yourImage forState:UIControlStateNormal];Check with this code:
[myButton setTitle:content forState:UIControlStateSelected]; [myButton setImage:nil forState:UIControlStateSelected]; [myButton setImage:yourImage forState:UIControlStateNormal];更多推荐
发布评论