iPhone Force Textbox Input to Upper Case

前端 未结 11 1630
无人共我
无人共我 2020-12-15 03:01

How do I force characters input into a textbox on the iPhone to upper case?

11条回答
  •  情歌与酒
    2020-12-15 03:41

    This is my code, when i have 6 textFields

    Hope you will get the point

    - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
        if (textField==self.textField6) {
            self.textField6.text = [textField.text stringByReplacingCharactersInRange:range withString:[string uppercaseString]];
            return NO;
        }
        return YES;
    }
    

提交回复
热议问题