在使用中,可以直接把下面的类复制到项目中,在创建文本框的类中添加如下代码:
self.field=[[UITextField_UIKeyBoard alloc]init];
CGRect fieldRect=CGRectMake(0, 420, 250, 40);
if(IS_IPHONE_5)
{
fieldRect=CGRectMake(0, 526, 250, 40);
}
self.field.rect=fieldRect;
[self.field textFieldFrame:self.field.rect viewController:self];
提到的类为:
#import <Foundation/Foundation.h>
@interface UITextField_UIKeyBoard : NSObject<UITextFieldDelegate>
@property(retain,nonatomic) UITextField * myTextField;
@property(assign,nonatomic) CGRect rect;
-(void)textFieldFrame:(CGRect)_rect viewController:
(UIViewController *)viewController;
@end
#import "UITextField_UIKeyBoard.h"
@implementation UITextField_UIKeyBoard
@synthesize myTextField=_myTextField,