What code would I use if I wanted to use a button to add a point (.) into a any selected textbox which already has a value in it. I can easily do this;
textField.text = @".";
开发者_如何学编程
But this only works with one text box and clears the value.
textField
doesn't mean any text field it is only connected to one.
If you have many variables referencing the text fields you have. just loop (using a for loop) through them and check for the one whose editing
property is set to YES
.
If you want to add a fullstop to the end of the text field's text use:
textField.text = [NSString stringByAppendingString:@"."];
精彩评论