Xcode如何添加IBAction来打开图像?
你好, 我正在尝试通过单击按钮打开图像, 有
@interface FirstDetailViewController : UIViewController {
IBOutlet UIButton *premi;
IBOutlet UIImageView *figura;
UIButton *apri;
}
@property (nonatomic, retain) IBOutlet UIButton *apri;
@end
在我的 .h
中,我的 .m
文件中
@implementation FirstDetailViewController
- (IBAction)apri:(id)sender {
}
我必须使用哪些代码? 非常感谢
HI,
I am trying to open an image by clicking a button,
in my .h
i have
@interface FirstDetailViewController : UIViewController {
IBOutlet UIButton *premi;
IBOutlet UIImageView *figura;
UIButton *apri;
}
@property (nonatomic, retain) IBOutlet UIButton *apri;
@end
in my .m
file
@implementation FirstDetailViewController
- (IBAction)apri:(id)sender {
}
which code I have to use ?
thank you very much
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还需要在 .h 中包含
- (IBAction)apri:(id)sender;
。就按钮使用而言,您的逻辑是正确的,您可以在 Interface Builder 中将
premi
连接到apri:
。就“打开”图像而言,处理图像的方法有很多种。您可以加载具有指定图像的 UIImageView,或使用 UIWebView,或许多其他方式。
You would also need to include
- (IBAction)apri:(id)sender;
in your .h.Your logic is right as far as the button usage, you would connect
premi
toapri:
in Interface Builder.AS far as "opening" an image, there are many ways to handle an image. You can load a UIImageView with a specified image, or use a UIWebView, or many other ways.