How to make a UIImageView open a URL in Safari when user clicks it?
+2
A:
I would suggest using a button for this purpose instead. You can create a custom UIButton with whatever image you want. This gives the advantage of providing the built-in target-action mechanism of a button, as well as being able to provided a highlighted image to provide the user feedback. Consider using something like this:
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:[UIImage imageNamed:@"regular_image.png"] forState:UIControlStateNormal];
[button setImage:[UIImage imageNamed:@"highlighted_image.png"] forState:UIControlStateHighlighted];
[button addTarget:self action:@selector(loadURL) forControlEvents:UIControlEventTouchUpInside];
Note that it will still look like "just an image" to the user.
glorifiedHacker
2010-04-01 18:22:59