Home » iPhone » Disabling default zoom for UIWebView

Disabling default zoom for UIWebView

Make and add custom object from UIView on top UIWebView

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@interface CUIView : UIView {
     UIWebView *web;
     int time;
}
@property (nonatomic, assign) UIWebView *web;
@end


@implementation CUIView

@synthesize web;

-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {   

     BOOL forwardToSuper = YES;

     if (time == (int)event.timestamp) {
               // prevent this
               forwardToSuper = NO;
     }         

     time = event.timestamp;
     
     if (forwardToSuper){
          //return self.superview;
          return [web hitTest:point withEvent:event];
     }
     else {
          // Return the superview as the hit and prevent
          // UIWebView receiving double or more taps
          return [super hitTest:point withEvent:event];
     }
}
@end