开发者

Setting Textbox Value with Button (iPhone SDK)

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜