Hello again, the second question I wanted to ask is: How can I remove some characters from TextField by clicking on Button. those. Suppose I have a text (phone number) - +7 (123) 456-78-90, after pressing the characters are deleted - @ "+ () -", it turns out: 71234567890. Do I use textDidChange? Tell me?)
1 answer
NSString* phoneNumber = [self.phoneTextField.text stringByReplacingOccurrencesOfString:@" " withString:@""]; phoneNumber = [phoneNumber stringByReplacingOccurrencesOfString:@"+" withString:@""]; phoneNumber = [phoneNumber stringByReplacingOccurrencesOfString:@"(" withString:@""]; phoneNumber = [phoneNumber stringByReplacingOccurrencesOfString:@")" withString:@""]; phoneNumber = [phoneNumber stringByReplacingOccurrencesOfString:@"-" withString:@""]; like that
- Doesn't work: C, did everything right - SuperPonchik
- Only if without NSString, directly .. - SuperPonchik
|
TextFieldas string? Filter characters in a string? Write back changed text inTextField? - VladD