iPhoneSDK可以通过xcode获得在interface builder中创建的对象吗?
我可以通过程序获取在xcode中的Interface builder中创建的对象吗 我已经设置了对象的标签和名称(UIButton)。 情况是,我使用iAction进行“按钮按下”操作,我可以得到触发该操作的当前按钮,但如果我想得到上一个按钮并设置其图像,该怎么办iPhoneSDK可以通过xcode获得在interface builder中创建的对象吗?,iphone,xcode,iphone-sdk-3.0,interface-builder,ibaction,Iphone,Xcode,Iphone Sdk 3.0,Interface Builder,Ibaction,我可以通过程序获取在xcode中的Interface builder中创建的对象吗 我已经设置了对象的标签和名称(UIButton)。 情况是,我使用iAction进行“按钮按下”操作,我可以得到触发该操作的当前按钮,但如果我想得到上一个按钮并设置其图像,该怎么办 任何建议都会有帮助 如果您知道标签,您可以通过以下方式获得UIButton: UIButton *button = [self.view viewWithTag:42]; [button setImage.... 如果您经常更改图像
任何建议都会有帮助 如果您知道标签,您可以通过以下方式获得UIButton:
UIButton *button = [self.view viewWithTag:42];
[button setImage....
如果您经常更改图像,我会推荐一个连接到您的IBOutlet按钮
如果你真的需要最后一个按钮,你可以把它放在某个地方,最好是放在ivar里
- (IBAction)buttonAction:(id)sender {
[lastButton setImage:....];
[sender doSomething];
lastButton = sender;
}
谢谢!这正是我要找的。