UITextInputDelegate 的使用

来源:互联网 发布:好看的日剧知乎 编辑:程序博客网 时间:2024/05/17 01:21

再控制器中实现UITextInputDelegate与UITextFieldDelegate的协议。


infoTF.delegate =self


然后


    func textField(textField:UITextField, shouldChangeCharactersInRange range:NSRange, replacementString string:String) -> Bool {

        textField.inputDelegate =self

        

    }


此时能实现

    func textWillChange(textInput:UITextInput) {


    }


    func textDidChange(textInput:UITextInput) {

        

    }


    

    func selectionWillChange(textInput:UITextInput){

    }

    

    func selectionDidChange(textInput:UITextInput){


    }

使用UITextInput对UITextField操作修改对应位置的文本

0 0
原创粉丝点击