开发者

Setting Textbox Value with Button (iPhone SDK)

开发者 https://www.devze.com 2023-02-08 21:03 出处:网络
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;

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:@"."];
0

精彩评论

暂无评论...
验证码 换一张
取 消