IOS UITextField

_helloField = [[UITextField alloc] initWithFrame:CGRectMake(70, 150, 140, 40)];

    //样式,如果要用自定义图片背景的话要设成none

    _helloField.borderStyle = UITextBorderStyleLine;

    _helloField.placeholder = @"提醒用户";

    _helloField.tag = 123;

    //每次开始编辑的时候清除原有内容

    _helloField.clearsOnBeginEditing = YES;

    //开始编辑后,出现清除按钮

    _helloField.clearButtonMode = UITextFieldViewModeWhileEditing;

    //设置背景图片

    //_helloField.background = [UIImage imageNamed:@"navigation"];

    

    //设置为密码输入

    //_helloField.secureTextEntry = YES;

    

    //自定义右边小图标(自定义clear button)

    UIView *rightview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];

    rightview.backgroundColor = [UIColor redColor];

    _helloField.rightView = rightview;

    _helloField.rightViewMode = UITextFieldViewModeWhileEditing;

    

    //自定义系统键盘

    /*

    UIView *csView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 200)];

    csView.backgroundColor = [UIColor blueColor];

    _helloField.inputView = csView;

     */

    

    //与系统键盘共存,在系统键盘上再加一块儿

    UIView *csView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];

    csView.backgroundColor = [UIColor blueColor];

    _helloField.inputAccessoryView = csView;

    

    //键盘类型

    //_helloField.keyboardType = UIKeyboardTypeNumberPad;

    

    //返回键设置

    _helloField.returnKeyType = UIReturnKeyDone;

    

    //设置键盘大小写

    _helloField.autocapitalizationType = UITextAutocapitalizationTypeNone;

    

    [self.view addSubview:_helloField];

    


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值