Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 uitextfield 我想它应该从顶部而不是中心开始输入文本 我的文本字段高度是 100 如何做到这一点。
IBOutlet UITextField*commentTextField; comments=commentTextField.text;
您可以实现 and 的textView:shouldChangeTextInRange:replacementText:方法UITextViewDelegate,检查替换文本是否为\n,然后隐藏键盘。
textView:shouldChangeTextInRange:replacementText:
UITextViewDelegate
\n
用这个:
textfield.contentVerticalAlignment = UIControlContentVerticalAlignmentTop;