0

I'm trying to find how I can load a webpage when the user click on my image (in a UIImageView). example: If the user click on the logo google,the application will go on www.google.fr.

Thanks :)

1 Answer 1

1

First, you need to react to a "tap" gesture on the ImageView.

On iOS 3.2 and later, this is made very easy by UITapGestureRecognizer:

UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapFrom:)];
[self.imageView addGestureRecognizer:recognizer];
recognizer.delegate = self;
[recognizer release];

.. then, in the tap handler, you can open your url:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.stackoverflow.com"]];

References:

UITapGestureRecognizer Class Reference

UIApplication Class Reference / openURL

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.