0
我是iphone开发新手。我试图开发与图像按钮(当我点击按钮图像将显示)此应用程序将开发像iphone中的programmaticaly。iphone中的uibutton programmaticaly中添加图像
任何一个plz都可以帮我解决我的问题。
预先感谢您。
我是iphone开发新手。我试图开发与图像按钮(当我点击按钮图像将显示)此应用程序将开发像iphone中的programmaticaly。iphone中的uibutton programmaticaly中添加图像
任何一个plz都可以帮我解决我的问题。
预先感谢您。
这样做:
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.
做事的方式是伟大的,因为你可以设置图片为需要不同的显示出来。不同的UIControlStates可以在这里找到:http://developer.apple.com/library/ios/#documentation/uikit/reference/UIControl_Class/Reference/Reference.html#//apple_ref/c/tdef/UIControlState
快乐编码:)