初始化文字欄位
迅速
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
新增到故事板。