Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/44.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iPhoneSDK可以通过xcode获得在interface builder中创建的对象吗?_Iphone_Xcode_Iphone Sdk 3.0_Interface Builder_Ibaction - Fatal编程技术网

iPhoneSDK可以通过xcode获得在interface builder中创建的对象吗?

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.... 如果您经常更改图像

我可以通过程序获取在xcode中的Interface builder中创建的对象吗

我已经设置了对象的标签和名称(UIButton)。 情况是,我使用iAction进行“按钮按下”操作,我可以得到触发该操作的当前按钮,但如果我想得到上一个按钮并设置其图像,该怎么办


任何建议都会有帮助

如果您知道标签,您可以通过以下方式获得UIButton:

UIButton *button = [self.view viewWithTag:42];
[button setImage....
如果您经常更改图像,我会推荐一个连接到您的IBOutlet按钮

如果你真的需要最后一个按钮,你可以把它放在某个地方,最好是放在ivar里

- (IBAction)buttonAction:(id)sender {
    [lastButton setImage:....];
    [sender doSomething];
    lastButton = sender;
}

谢谢!这正是我要找的。