2011-09-20 188 views
0

我有一個父滾動視圖來顯示pdf.Inside有視圖。在視圖中有另一個滾動視圖進行縮放。在該滾動視圖中有覆蓋視圖。我需要了解覆蓋視圖。我怎麼才能得到它?獲取滾動視圖內的視圖

回答

0

添加一個UIGestureRecognizer到覆蓋視圖。不要忘記確保視圖的userActionEnabled屬性設置爲YES

0
Make a new NSObject Class ScrollWithTouch and write following method inside .h and .m file: 
Code for .h file: 

@interface ScrollWithTouch : UIScrollView { 
} 
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event; 
-(id)initWithCustomScrollView; 
@end 

Code for .m file: 
#import "ScrollWithTouch.h" 


@implementation ScrollWithTouch 

-(id)initWithCustomScrollView{ 
    if (self = [super init]) { 

    } 
    return self; 
} 


- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event 
{ 
    // If not dragging, send event to next responder 
    if (!self.dragging) 
     [self.nextResponder touchesEnded: touches withEvent:event]; 
    else 
     [super touchesEnded: touches withEvent: event]; 
} 
@end 

Now make a instance : 
ScrollWithTouch *tmpScrollView; 
tmpScrollView = [[ScrollWithTouch alloc] initWithCustomScrollView]; 

Add this new created object with your self.view; 
Now write touch related method within self.view. 
Assign tag for scroll view or assign tag for sub views on scroll view. 
Now you are ready to getting touch tag on tapping over scroll view.