作者:朱克锋
邮箱:zhukefeng@iboxpay.com
转载请注明出处:http://blog.youkuaiyun.com/linux_zkf
UITextField *tf;
初始化
tf = [[UITextField alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 100.0f, 30.0f)];
tf.center = CGPointMake(160.0f, 120.0f);
边框类型
tf.borderStyle = UITextBorderStyleRoundedRect;
自动纠错
tf.autocorrectionType = UITextAutocorrectionTypeNo;
预置字段
tf.placeholder = @"Name";
返回键类型
tf.returnKeyType = UIReturnKeyDone;
清楚小按钮(小的X)
tf.clearButtonMode = UITextFieldViewModeWhileEditing;
tf.delegate = self;
[self.view addSubview:tf];
[tf release];
本文介绍如何使用 Objective-C 对 UITextField 进行初始化,并设置其属性,包括位置、大小、边框样式、自动纠错、预置文本、返回键类型、清除按钮等。
280

被折叠的 条评论
为什么被折叠?



