Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. -(void)disableReturnKey{
  2. // Locate non-UIWindow.
  3. UIWindow *keyboardWindow = nil;
  4. for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) {
  5. if (![[testWindow class] isEqual:[UIWindow class]]) {
  6. keyboardWindow = testWindow;
  7. break;
  8. }
  9. }
  10.  
  11. // Locate UIKeyboard.
  12. UIView *foundKeyboard = nil;
  13. for (UIView *possibleKeyboard in [keyboardWindow subviews]) {
  14.  
  15. // iOS 4 sticks the UIKeyboard inside a UIPeripheralHostView.
  16. if ([[possibleKeyboard description] hasPrefix:@"<UIPeripheralHostView"]) {
  17. possibleKeyboard = [[possibleKeyboard subviews] objectAtIndex:0];
  18. }
  19.  
  20. if ([[possibleKeyboard description] hasPrefix:@"<UIKeyboard"]) {
  21. foundKeyboard = possibleKeyboard;
  22. break;
  23. }
  24. }
  25.  
  26. [foundKeyboard performSelector:@selector(setReturnKeyEnabled:) withObject:NO];
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement