我正在创建UITextField programmaticaly,用于收集电子邮件地址以发送电子邮件。当用户输入多个电子邮件地址并且文本长度超过文本字段长度时,通常文本在左侧移动。 但如果我想编辑我输入的第一个电子邮件地址,我就无法滚动到左侧。
以下是创建Textfield的代码:
let ToTextField = UITextField(frame: CGRectMake(140, 150, 500, 40))
ToTextField.text = "To"
ToTextField.textColor = UIColor(red:204/255, green:204/255, blue:204/255, alpha:1.0)
ToTextField.font = UIFont.systemFontOfSize(15)
ToTextField.borderStyle = UITextBorderStyle.RoundedRect
ToTextField.autocorrectionType = UITextAutocorrectionType.No
ToTextField.autocapitalizationType = UITextAutocapitalizationType.None
ToTextField.keyboardType = UIKeyboardType.Default
ToTextField.returnKeyType = UIReturnKeyType.Done
ToTextField.clearButtonMode = UITextFieldViewMode.WhileEditing
ToTextField.contentVerticalAlignment = .Center
ToTextField.contentHorizontalAlignment = .Left
ToTextField.tag=776756
ToTextField.delegate = self
self.SendMessageForm.addSubview(ToTextField)
有没有办法让它水平向左右方向滚动?