我在我的登錄視圖控制器中成功導入了IQKeyboardManger。從那以後,我加入這個代碼IQKeyboardManager不適用於視圖控制器中的文本字段?
//在viewDidLoad中
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//IQKeyboardManager
[[IQKeyboardManager sharedManager] setEnable:YES];
[[IQKeyboardManager sharedManager] setKeyboardDistanceFromTextField:100];
[[IQKeyboardManager sharedManager] setEnableAutoToolbar:YES];
[[IQKeyboardManager sharedManager] setShouldShowTextFieldPlaceholder:YES];
[self.ad.window makeKeyAndVisible];
}
但它不是在iOS的工作11.0
屏幕1
屏幕2
我在應用程序委託添加的代碼
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
//Identify launching status(Is first time or not)
//If it is first time go to login page
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"]) {
self.lpvc = [self.mainStoryboard instantiateViewControllerWithIdentifier:@"LPVC"];
self.window.rootViewController = self.lpvc;
NSLog(@"Launched first time");
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"];
[[NSUserDefaults standardUserDefaults] synchronize];
//IQKeyboarbManager
[[IQKeyboardManager sharedManager] setEnable:YES];
// [[IQKeyboardManager sharedManager] setKeyboardDistanceFromTextField:100];
[[IQKeyboardManager sharedManager] setEnableAutoToolbar:YES];
[[IQKeyboardManager sharedManager] setShouldShowTextFieldPlaceholder:YES];
} else {
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"loggedin"]) {
self.rvc = [self.mainStoryboard instantiateViewControllerWithIdentifier:@"RVC"];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:self.rvc];
NSLog(@"Already launched");
[self getDataFromServer];
// [self.rvc checkAppVersion];
}
}
[self.window makeKeyAndVisible];
return yes;
有何利用這一[self.ad.window makeKeyAndVisible] –
究竟什麼不行?你在期待什麼? – Glenn
@ Anbu.Karthik我不完全一樣,我從這個鏈接複製..... http://www.binpress.com/app/iqkeyboardmanager/1869 – iOS