I am creating a simple project for iPhone using Xcode and Interface Builder. Although I understand what a delegate is, I have a problem with using it.
I have a UITextField in my interface. It displays the keyboard when the user clicks on it, but I need to manually program how to hide the keyboard. This can be done using delegates. Therefore, in IB, I take an Object from the library, providing it with the name of the Control1Delegate class, and then connecting the delegate output from my text box to be this Control1Delegate. I also have .m and .h files for this Control1Delegate class:
Control1Delegate.h
@interface Control1Delegate : NSObject <UITextFieldDelegate> {
}
- (BOOL) textFieldShouldReturn:(UITextField *)textField;
@end
Control1Delegate.m
#import "Control1Delegate.h"
@implementation Control1Delegate
- (BOOL) textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder];
return YES;
}
@end
. textFieldShouldReturn msg EXEC_BAD_ACCESS. , ( ) UITextField (File Owner), , . , Apple , - , . ?
? - ? ?