use*_*767 0 iphone cocoa-touch
我是iphone开发的新手.我试图用图像开发按钮(当我点击按钮时图像会显示)这个应用程序将像iphone中的programmaticaly一样开发.
任何人都可以帮我解决我的问题.
先感谢您.
做这个:
UIImage *newButtonImage = [UIImage imageNamed:@"imageInMyProject.png"];
//Create image object from bundle. Name must include filetype; is case sensetive.
[myButton setImage:newButtonImage forState:UIControlStateNormal];
//Set the image for the button when it is in it's default state.
Run Code Online (Sandbox Code Playgroud)
这种做事方式很棒,因为您可以根据需要将图像设置为不同的显示方式.可以在此处找到不同的UIControlStates:http://developer.apple.com/library/ios/#documentation/uikit/reference/UIControl_Class/Reference/Reference.html#//apple_ref/c/tdef/UIControlState
快乐编码:)
| 归档时间: |
|
| 查看次数: |
2546 次 |
| 最近记录: |