الجمعة، 20 ديسمبر 2013

disable/enable return key in UITextField?

One good idea is to create one file to access this class from anywhere. Here is the code:

UIKeyboard.h

#import @interface UIApplication (KeyboardView) - (UIView *)keyboardView; @end

UIKeyboard.m

#import "UIKeyboard.h"@implementation UIApplication (KeyboardView)- (UIView *)keyboardView{ NSArray *windows = [self windows]; for (UIWindow *window in [windows reverseObjectEnumerator]) { for (UIView *view in [window subviews]) { if (!strcmp(object_getClassName(view), "UIKeyboard")) { return view; } } } return nil;}@end

Now you can import and access this class from your own class:

#import "UIKeyboard.h" // Keyboard Instance Pointer. UIView *keyboardView = [[UIApplication sharedApplication] keyboardView];

A full documentation of this class you can find here: http://ericasadun.com/iPhoneDocs/_u_i_keyboard_8h-source.html

More information you can find here: http://cocoawithlove.com/2009/04/showing-message-over-iphone-keyboard.html


View the original article here

ليست هناك تعليقات:

إرسال تعليق