Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Carter Randall3,311 Points
Accessing and manipulating Integer values from a textField
I playing around with fun concepts and was wondering how you handle numeric inputs into a text field. I set the keyboard type to "number pad" and created IBOutlets from each value. How would one go about getting the input and inserting it into a formula? Here's a couple screen shots as an example:
If you want to get the value of a text field, you simply access its "text" property
var textFromTextField = self.textField.text
EDIT: Just now realizing you're working in Objective-C
UITextField *textField = [[UITextField alloc] initWithFrame:self.someObj.frame]; textField.text = @"Here I am"; NSString *textFromTextField = textField.text;