Home Tutorial Iphone Examples becomeFirstResponder UITextField

 
 

Share on Google+Share on Google+
becomeFirstResponder UITextField
Posted on: August 9, 2010 at 12:00 AM
Advertisement
In this iPhone SDK example, we are going to discuss about becomeFirstResponder that belongs to UIResponder class.

becomeFirstResponder UITextField

In this iPhone SDK example, we are going to discuss about becomeFirstResponder that belongs to UIResponder class. In simple words UIResponder is a responders for objects that respond to and handle events. Where as "becomeFirstResponder" is an instance method of it that notifies the receiver about it's status of becoming the first responder in its window.

Also remember that in case of two responders, responder object will act as in case of current responder resign from being the first responder status. In this example we are discussing about the same condition. In the example we have two text field and we wants the second text field to act as fist responder in case of first text field is left blank.

Basically, in this application we are comparing two variables for certain condition and for the comparison we can use isEqualToString(for NSString) and isEqualToNumber(for NSNumber). The given example will check if the first text field is blank or not. If the first text field is blank that means it is satisfying the condition and and the second text field will become first responder.

See the given line of code...
if ([txtField.text isEqualToString:@""]) [txtField2 becomeFirstResponder];

Download Code

Advertisement

Related Tags for becomeFirstResponder UITextField:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: August 9, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com