I have a tab-bar application. In one of the view(.xib), there is a text field and a button. The button supposed to save the text inputted in textField.
However, no matter what i typed, it always read (nil) in textField.text in debug.
When i right click the textField in .xib, i cannot drag the [New Referencing Outlet] to [File's Owner]. i can only drag the [delegate] to [File's Owner]. Does anyone have idea on why i can't do so?
Below the the .h file:
@interface AddDebtorViewController : UIViewController
{
UITextField *tDebtorName;
}
@property (retain, nonatomic) IBOutlet UITextField *tDebtorName;
-(IBAction)returnButPressed:(id)sender;
-(IBAction)addDebtorButPressed:(id)sender;
@end
Below is the .m file:
#import "AddDebtorViewController.h"
@implementation AddDebtorViewController
@synthesize tDebtorName;
- (IBAction)addDebtorButPressed:(id)sender
{
NSString *debtorName = [[NSString alloc] init];
debtorName = tDebtorName.text;
NSLog(debtorName);
}
...
@end