5

I'm a beginner trying to create my first app. I'm trying to get the user to enter in a number into the the textfield, the app does what it does, and then the answer gets placed into the textfield itself. I'm using the storyboard to make this.

For example:

User puts '1' into textfield, 'a' gets placed in place once the user presses enter.

Thanks.

4

3 回答 3

6

You can change the .text property, for example:

self.textField.text = [NSString stringWithFormat:@"%@a", self.textField.text];
于 2013-02-14T02:14:25.300 回答
2

If youy're simply passing the string then,

txtField.text = @"Hello"

and If you're getting text from UITextField then,

txtField.text = [NSString stringWithFormat:@"%@a",txtField.text];

txtField is an outlet of UItextField

于 2014-11-25T04:41:50.927 回答
1

Just go through some beginners guide and understand the concepts. Please refer http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-uitextfield-uitextfielddelegate/ to get an idea of how to place UITextfield and adding events and all.

于 2013-02-14T07:20:12.120 回答