Learning iOS Programming by Alasdair Allan

Learning iOS Programming by Alasdair Allan

Author:Alasdair Allan [Alasdair Allan]
Language: eng
Format: epub
Tags: COMPUTERS / Programming / Apple Programming
ISBN: 9781449304485
Publisher: O'Reilly Media
Published: 2012-03-12T16:00:00+00:00


If your application has more than one text field in the view, it’s useful to keep track of which is currently the active field by using an instance variable.

Note

After implementing the delegate protocol, open the nib that contains the UITextField (that would be the AddCityController.xib in the case of CityGuide). Then click and Control-drag from the UITextField to the File’s Owner icon and select delegates from the pop-up that appears to make the connection. Save the nib when you’re done.

When the user taps the text field, the textFieldShouldBeginEditing: method is called in the delegate to ascertain whether the text field should enter edit mode and become the first responder. To implement this, you’d add the following to your controller’s implementation (such as AddCityController.m):

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { activeTextField = textField; return YES; }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.