标签:
?// 设置return 的样式
textFiled.returnKeyType = UIReturnKeyGo;
?// 设置 自定义 弹出视图(自定义键盘)
UIView *inputView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 200)];
inputView.backgroundColor = [UIColor cyanColor]; textFiled.inputView = inputView;
?// 设置键盘 上的辅助视图
UIView *inputAccView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 40)];
inputAccView.backgroundColor = [UIColor cyanColor];
//textFiled.keyboardType = UIKeyboardTypeNumberPad;
textFiled.inputAccessoryView = inputAccView;
[inputAccView release];
#pragma mark --- UITextFailed
// 当点击键盘上的 return 时, 触发该方法
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
//点击 return 回收键盘
[textField resignFirstResponder];
return YES;
}
#pragma mark --- 该方法不是协议中的方法啊
// 点击空白, 回收键盘
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UIView *containerView = [self.window viewWithTag:100];
UITextField *textFD = (UITextField *)[containerView viewWithTag:200];
[textFD resignFirstResponder];
}
标签:
原文地址:http://www.cnblogs.com/tapple/p/4898997.html