首页 > 其他 > 详细

TextFiled 自定义视图, 点击回收键盘;

时间:2015-10-21 21:06:43      阅读:369      评论:0      收藏:0      [点我收藏+]

?// 设置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];

    

}

TextFiled 自定义视图, 点击回收键盘;

原文:http://www.cnblogs.com/tapple/p/4898997.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!