ios: UI学习总结(user Interface) UITextField

来源:互联网 发布:网络道德规范的主体是 编辑:程序博客网 时间:2024/05/22 12:35
1、UITextField:


#pragma mark 通过代码创建UITextField
-(void)makeUITextFieldWithSourcecode{


    UITextField *textField =[[UITextField alloc]initWithFrame:CGRectMake(100, 100, 200, 30)];
    [textField setTextAlignment:NSTextAlignmentCenter];
    textField.font = [UIFont systemFontOfSize:20];
    [textField setBackgroundColor:[UIColor redColor]]; //注意要给UITextField设置background(图片或者color)否则在界面上会看不到
    [self.view addSubview:textField];
}
0 0
原创粉丝点击