1
How do I use Vmasktextfield with Swift?
self.comVM.Mask = "###(##)##"
1
How do I use Vmasktextfield with Swift?
self.comVM.Mask = "###(##)##"
2
Example:
class ViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var comVM: VMaskTextField!
override func viewDidLoad() {
super.viewDidLoad()
comVM.mask = "(##) ####-####";
comVM.delegate = self;
}
func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
return comVM.shouldChangeCharactersInRange(range, replacementString: string);
}
}
Don’t forget to change the class of UITextField
for VMaskTextField
in storyboard/nib .
It didn’t work here. = / is giving this error 2017-08-02 17:18:45.161 iSkyNote[29691:421271] *** Terminating app due to uncaught Exception 'Nsinvalidargumentexception', Ason: '-[Uitextfield setTextWithMask:]: unrecognized selector sent to instance 0x7afb7450'
Browser other questions tagged swift
You are not signed in. Login or sign up in order to post.
Please serve this answer: http://answall.com/questions/40229/máscara-para-uitextfield/40293#40293
– Ricardo Pereira