项目中有时会需要在系统键盘出现时也能在界面上展示提示文字,此时需要获取系统键盘的窗口,再在此窗口上展示,才不会被遮挡
-(UIWindow *)returnKeyBoardWindow
{
UIWindow *view = [[[UIApplication sharedApplication] delegate] window];
NSArray *windows = [UIApplication sharedApplication].windows;
for (id changeWindow in windows) {
NSString *viewName = NSStringFromClass([changeWindow class]);
if ([@"UIRemoteKeyboardWindow" isEqualToString:viewName]) {
view = changeWindow;
break;
}
}
return view;
}
网友评论