初始化文本字段
迅速
let frame = CGRect(x: 0, y: 0, width: 100, height: 100)
let textField = UITextField(frame: frame)
Objective-C
CGRect *frame = CGRectMake(0, 0, 100, 100);
UITextField *textField = [[UITextField alloc] initWithFrame:frame];
Interface Builder
你还可以通过从对象库中拖动它来将 UITextField
添加到故事板。