开发者

Change a UIImage programmatically [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 4 years ago.

Improve this开发者_C百科 question

i have 2 UIImages and a UISwitch, when the switch is on, image 1 appear and when the switch is off the image 2 appear... any ideas?


If you have a UISwitch called myUISwitch and a UIImageView called myUIImageView:

if(myUISwitch.on) {  
    [myUIImageView setImage:[UIImage imageNamed:@"myOnImage.png"]];  
}  
else {  
    [myUIImageView setImage:[UIImage imageNamed:@"myOffImage.png"]];  
}

You can put this code in the function triggered by changing the UISwitch...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜