我正在使用一个UIScrollview和UIimageview(这是UIScrollview的子视图),并且我想在UIImageview上使用UIPinchgesturerecognizer,但是它不起作用。
It's Simple, you can use it like this :
yourImageView = [[UIImageView alloc] initWithImage:yourImage];
[yourScrollView addSubview:yourImageView];
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
[yourImageView addGestureRecognizer:singleTap];
[sibgleTap release];
GoodLuck.
I got answer after googling, I dissable all gesture of scrollview and then set userinteraction of UIImageview YES, I dissable gesture of UIScrollview using the this code
for (UIGestureRecognizer* recognizer in [scrollviewFrame1 gestureRecognizers]) {
if ([recognizer isKindOfClass:[UIPinchGestureRecognizer class]]) {
[recognizer setEnabled:NO];
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.