Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(void)disableReturnKey{
- // Locate non-UIWindow.
- UIWindow *keyboardWindow = nil;
- for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) {
- if (![[testWindow class] isEqual:[UIWindow class]]) {
- keyboardWindow = testWindow;
- break;
- }
- }
- // Locate UIKeyboard.
- UIView *foundKeyboard = nil;
- for (UIView *possibleKeyboard in [keyboardWindow subviews]) {
- // iOS 4 sticks the UIKeyboard inside a UIPeripheralHostView.
- if ([[possibleKeyboard description] hasPrefix:@"<UIPeripheralHostView"]) {
- possibleKeyboard = [[possibleKeyboard subviews] objectAtIndex:0];
- }
- if ([[possibleKeyboard description] hasPrefix:@"<UIKeyboard"]) {
- foundKeyboard = possibleKeyboard;
- break;
- }
- }
- [foundKeyboard performSelector:@selector(setReturnKeyEnabled:) withObject:NO];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement