触摸UIWebview随机隐藏/取消隐藏inputAccessoryView

时间:2018-09-11 12:19:52

标签: ios objective-c xcode html5 uiwebview

我正在添加一个UIWebview--

NSString *urlAddress = @"https://www.google.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
UIWebView *playerView = [[UIWebView alloc] init];
playerView.userInteractionEnabled = NO;
[playerView setBackgroundColor:[UIColor grayColor]];
[playerView setFrame:CGRectMake(0, 0, self.view.bounds.size.width, 400)];
[playerView loadRequest:requestObj];
[playerView setHackishlyHidesInputAccessoryView:YES];
[self.view addSubview:playerView];

和一个输入附件视图-

- (BOOL) canBecomeFirstResponder {
    return true;
}


- (UIView *)inputAccessoryView {

    UIView *playerView = [[UIView alloc] init];
    [playerView setBackgroundColor:[UIColor greenColor]];
    [playerView setFrame:CGRectMake(0, 0, self.view.bounds.size.width, 50)];
    return playerView;
}

现在的问题是,当我在任何地方触摸Web视图页面时,附件视图都会隐藏或取消隐藏。

我想展示配件。无论如何,它都不应该隐藏。有想法吗?

0 个答案:

没有答案