3

UIGestureRecognizerDelegateをUIWebViewに追加したいのですが、失敗しました。

if [self.view addsubView:webView]; したがって、UIWebViewは問題ありませんが、UIGestureRecognizerDelegateは問題ありません。

[self.view addsubView:webView]を削除する場合; したがって、UIGestureRecognizerDelegateは問題ありませんが、何も表示されません。

- (void)viewDidLoad {
    [super viewDidLoad];

webView= [[UIWebView alloc] initWithFrame:CGRectMake(0.0f, -2.0f, 320.0f, 415.0f)];

if (_refreshHeaderView == nil) {
    webScroller = (UIScrollView *)[[webView subviews] objectAtIndex:0];
    [webScroller setDelegate:self];

    EGORefreshTableHeaderView *view = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f - webScroller.bounds.size.height, self.view.frame.size.width, webScroller.bounds.size.height)];
    view.delegate = self;
    [webScroller addSubview:view];
    _refreshHeaderView = view;
}

[_refreshHeaderView refreshLastUpdatedDate];

[self.view addSubview:self.webView];


// Set up recognizers.
UITapGestureRecognizer *doubleTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
doubleTapRecognizer.numberOfTapsRequired = 2;
doubleTapRecognizer.delegate = self;
[self.view addGestureRecognizer:doubleTapRecognizer];

UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
tapRecognizer.delegate = self;
[self.view addGestureRecognizer:tapRecognizer];

}
4

1 に答える 1