iPhone restrict user from entering space in textfield

前端 未结 6 2012
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-05 08:40

i want to restrict user from entering space in a UITextField. for this i m using this code

- (BOOL)textField:(UITextField *)textField shouldChangeCharacters         


        
6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-05 09:23

    The problem is

    string == @" "
    

    is wrong. Equality for strings is done using:

    [string isEqualToString:@" "]
    

    :).

提交回复
热议问题