logo
  • 教程列表
  • SO官方文檔
  • UITextField
    • 獲取鍵盤焦點和隱藏鍵盤
    • 輸入附件檢視(工具欄)
    • 使用者按下返回按鈕時關閉鍵盤
    • 隱藏閃爍的插入符號
    • 初始化文字欄位
    • Autocapitalization
    • 關閉鍵盤
    • 設定對齊
    • 鍵盤型別
    • 當 UITextView 成為第一響應者時移動滾動
    • 用 UIPickerView 替換鍵盤
    • 獲取和設定游標位置
    • 更改佔位符顏色和字型
    • 建立一個 UITextField
  1. StackOverflow 文件
  2. iOS 教程
  3. UITextField
  4. 建立一個 UITextField

建立一個 UITextField

Created: November-22, 2018

使用 CGRect 作為框架初始化 UITextField:

迅速

let textfield = UITextField(frame: CGRect(x: 0, y: 0, width: 200, height: 21))

Objective-C

UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 200, 21)];

你還可以在 Interface Builder 中建立 UITextField: StackOverflow 文件

  • 更改佔位符顏色和字型

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明