i want to restrict user from entering space in a UITextField. for this i m using this code
- (BOOL)textField:(UITextField *)textField shouldChangeCharacters
string == @" "
Isn't that just going to compare the adress of each of string
and @" "
? Thats not the comparison you want to do.
Also do you want to prevent them from entering a string that is just a space? If so then you need to change that ==
into a proper string comparison and you are good to go. If not and you want to prevent all spaces in an input string then you need a string matcher