- (void)viewDidLoad
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(willShowKeyboard:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didShowKeyboard:)
name:UIKeyboardDidShowNotification
object:nil];
}
#pragma mark - Keybord function
- (void)willShowKeyboard:(NSNotification *)notification {
[self performSelector:@selector(removeKeyboardShadow) withObject:nil afterDelay:0.0];
}
#pragma mark - Other Function
- (void)removeKeyboardShadow
{
for (UIWindow *window in [UIApplication sharedApplication].windows.reverseObjectEnumerator) {
if (![window.class isEqual:[UIWindow class]]) {
for (UIView *view in window.subviews) {
if (strcmp("UIPeripheralHostView", object_getClassName(view)) == 0) {
UIView *shadowView = view.subviews[0];
if ([shadowView isKindOfClass:[UIImageView class]]) {
shadowView.hidden = YES;
return;
}
}
}
}
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น