UITextField changing into UITextInputTraits
I have a UIViewController subclass that has a UITextField. It is loading from a xib. However, whenever I try to access the roomName instance variable after the view is initialized (e.g. in viewDidLoad), the debugger shows it as UITextInputTraits.
Here is my interface.
@interface AddRoomViewController : UIViewController <UITextFieldDelegate>{
IBOutlet UITextField *roomName;
id<AddRoomDelegate> *delegate;
}
- (IBAction)textFieldDidBeginEditing:(UITextField *)textField;
- (void) done;
@property (nonatomic, copy) UITextField *roomName;
@property (nonatomic, assign) id <AddRoomDelegate> *delegate;
@end
I am new to iOS development so I'm sure that I just missed a connection or something, but I am stumped.
Edit: I understand that it is a protocol, bu开发者_运维技巧t when I try to get the text from the UIText Field I get the following error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITextInputTraits text]: unrecognized selector sent to instance 0x4d16170'
UITextInputTraits
is a protocol, which UITextField
conforms to.
I removed the @property definition for my UITextField and that fixed the problem.
精彩评论