Setting UITextField Delegate Using Interface Builder and Not Updating the Header File
I am stepping into the deep waters of IPhone development. I have the following header file.
//
// FirstProjectViewController.h
// FirstProject
//
// Created by Mohammad Azam on 6/25/10.
// Copyright HighOnCoding 2010. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface FirstP开发者_运维技巧rojectViewController : UIViewController<UITextFieldDelegate> {
IBOutlet UITextField *number1TextField;
IBOutlet UITextField *number2TextField;
IBOutlet UILabel *resultLabel;
}
- (IBAction) add: (id) sender;
@end
I want to hide the virtual keyboard when the user clicks the "Return" key. For this my controller implements the UITextFieldDelegate. I also went to the interface builder and hooked up the UITextField delegate to the File Owner using connections. But my header file is never updated. Should it not updated and add a method called textFieldShouldReturn.
I have implemented textFieldShouldReturn method in my implementation file (.m) and it works fine but if the header file never updates with the definition of the textFieldShouldReturn method then how should I ever know that my implementation file needs to implement textFieldShouldReturn method.
Thanks,
If you don't want to share the function with other accessors outside the class, there is no need to add the function to the header file. The delegate protocol of UITextField declares which methods are required to implement and which are optional
regards
精彩评论