我使用theos成功编译了这个调整,它在ViewController中显示了UIWebView,但是当我按下webview中的任何文本字段时,我根本无法显示键盘,我做错了什么?
我试过[webView.window makeKeyAndVisible]; [webView canBecomeFirstResponder];方法,但没有运气。
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface myViewController : UIViewController <UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@end
%hook myViewController
-(void)viewDidLoad {
%orig;
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 44, 320, 342)];
[webView setDelegate:self];
NSString *urlAddress = @"https://www.google.com/";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
webView.scalesPageToFit=YES;
webView.backgroundColor = [UIColor clearColor];
[webView.window makeKeyAndVisible];
[webView canBecomeFirstResponder];
[self.view addSubview:webView];
%end