Is it possible to allow the uiimageview to be pressed and linked to another uiviewcontroller?
Is it possible to allow the uiimageview
to开发者_JS百科 be pressed and linked to another uiviewcontroller
?
Yes of course but you will find things much easier if you create an invisible UIButton (of type UIButtonTypeCustom) and place it over the UIImageView. It will process a touchUpInside as simply as a button because... it is a button. You can't see it but it can still capture a touch.
Because a UIImageView is a UIView it inherits methods to handle gestures and multi-touch events. Because it is also a UIResponder it inherits useful methods like touchesBegan and family. So you can use those methods to capture events yourself, but the button is the easiest way and is much easier to do in Interface Builder if you prefer to do it that way.
In the method handling the event, the familiar pattern
PriceViewController* priceVC = [[PriceViewController alloc] init];
[self.navigationController pushViewController:priceVC animated:YES];
[priceVC release];
is the rest of what you need.
精彩评论