I want to create a UITextField
like above image, with both placeholder in left side and name and Text in right side. Can someone please tell me how to do this.
You can set this by setting leftView
to the UITextFiled
You may declared var of IBOutlet for textfield.
let textField = UITextField()
or
@IBOutlet weak var textFiled: UITextFiled!
//create label
let lblName = UILabel(frame: CGRect(x: 0, y:0, width: 80, height: 30))
// --- set other properties to label
//set right view to text field
textField.leftView = lblName
textField.leftView wMode = .whileEditing
You can change leftViewMode
of the textField
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.