ios 指定页面禁用第三方键盘,使用系统的键盘
作者:
缘來諟夢 | 来源:发表于
2021-07-13 15:12 被阅读0次//强制使用系统键盘
- (BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(NSString *)extensionPointIdentifier{
if ([[self getCurrentVC] isKindOfClass:[CLSLoginViewController class]]) {
if ([extensionPointIdentifier isEqualToString:@"com.apple.keyboard-service"]) {
return NO;
}
}
return YES;
}
- (UIViewController *)getCurrentVC{
UIViewController *result = nil;
UIWindow * window = [[UIApplication sharedApplication] keyWindow];
if (window.windowLevel != UIWindowLevelNormal){
NSArray *windows = [[UIApplication sharedApplication] windows];
for(UIWindow * tmpWin in windows){
if (tmpWin.windowLevel == UIWindowLevelNormal){
window = tmpWin;
break;
}
}
}
UIView *frontView = [[window subviews] objectAtIndex:0];
id nextResponder = [frontView nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]])
result = nextResponder;
else
result = window.rootViewController;
return result;
}
本文标题:ios 指定页面禁用第三方键盘,使用系统的键盘
本文链接:https://www.haomeiwen.com/subject/zehspltx.html
网友评论