When you edit a text field, there are a lot of methods that seem really similar. You are trying to use-textFieldShouldBeginEditing:
. According to the documentation, textFieldShouldBeginEditing, "Asks the delegate if editing should begin in the specified text field." The usage is, "When the user performs an action that would normally initiate an editing session, the text field calls this method first to see if editing should actually proceed. In most circumstances, you would simply return YES from this method to allow editing to proceed." This is not what you wan't to do.
Instead you should use -textFieldDidBeginEditing:
. This method, "Tells the delegate that editing began for the specified text field." It, "notifies the delegate that the specified text field just became the first responder. You can use this method to update your delegate’s state information. For example, you might use this method to show overlay views that should be visible while editing."
This means your code should change from:
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
textField.layer.borderColor=[[UIColor cyanColor] CGColor];
}
to
-(BOOL)textFieldDidBeginEditing:(UITextField *)textField {
textField.layer.borderColor=[[UIColor cyanColor] CGColor];
}
You can read more about the UITextFieldDelegate
methods in the docs at http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextFieldDelegate_Protocol/UITextFieldDelegate/UITextFieldDelegate.html