UITextField控件

用处:输入控件

-(void)viewDidLoad

{

  [super viewDidLoad];

//设置大小

CGRect frame = CGRectMake(20,20,150,40);

//实例化UITextField

self.tf = [[UITextField alloc]initWithFrame:frame];

//提示信息(灰体)

self.tf.placeholder = @"type in password";

//边框样式

self.tf.borderStyle = UITextBorderStyleRoundedRect;

//对齐方式

self.tf.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;

self.tf.textAlignment = NSTextAlignmentLeft;

//密码

self.tf.secureTextEntry = YES;

//编辑时的清除按钮

self.tf.clearButtonMode = UITextFieldViewModeWhileEditing;

[self.view addSubView:self.tf];

}

posted @ 2014-08-06 14:56  迷茫的程序小生  阅读(107)  评论(0编辑  收藏  举报