Using `textField:shouldChangeCharactersInRange:`, how do I get the text including the current typed character?

前端 未结 10 2033
粉色の甜心
粉色の甜心 2020-12-02 05:23

I\'m using the code below to try and have textField2\'s text content get updated to match textField1\'s whenever the user types in textField1

10条回答
  •  青春惊慌失措
    2020-12-02 06:29

    This is the code you need,

    if ([textField isEqual:self.textField1])
      textField2.text = [textField1.text stringByReplacingCharactersInRange:range withString:string];
    

提交回复
热议问题