Marco
Marco

Reputation: 149

Xcode how to add IBAction for opening an image?

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

Upvotes: 1

Views: 4310

Answers (1)

WrightsCS
WrightsCS

Reputation: 50697

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 to apri: 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.

Upvotes: 2

Related Questions