Как начать UITextView из абзаца в Swift - PullRequest
0 голосов
/ 21 ноября 2018

Как начать новую строку в UITextView с небольшого пробела, называемого абзацем, я полагаю?

enter image description here

1 Ответ

0 голосов
/ 21 ноября 2018

Что вам нужно сделать, это настроить контроллер на UITextFieldDelegate

, например:

class ViewController: UIViewController,UITextFieldDelegate 
{
   //link the textfield
   @IBOutlet weak var textField: UITextField!

   override func viewDidLoad() 
   {
      super.viewDidLoad()
      // link the delegate to the textfield
      textField.delegate = self   
   }

    //this function detects the return button when it's pressed

   func textFieldShouldReturn(_ textField: UITextField) -> Bool 
   {
    //since we always want to start a new line with space we override the default function

     textField.text += "\n "
     return false
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...