我已经为这个 UIViewController 创建了一个委托,并且我传入了一个员工姓名来设置一个 UITextField。但是,无论我做什么,如您所见,它都会导致 (null)。但是,我有一个以类似方式填充的日期标签,但它可以正常工作。我把它包括在内以供参考。我错过了一些简单的东西。但是,现在我已经看不到它了……
有任何想法吗?谢谢。
@interface TimesheetEntryViewController()
@property (weak, nonatomic) IBOutlet UILabel *datelabel;
@property (weak, nonatomic) IBOutlet UITextField *employeeTextField;
@end
@implementation TimesheetEntryViewController
@synthesize tableView = _tableView;
@synthesize datelabel = _datelabel;
@synthesize employeeName = _employeeName;
@synthesize employeeTextField = _employeeTextField;
-(void)setEmployeeNameString:(NSString *)lemployeeNameString
{
self.employeeTextField.text = lemployeeNameString;
NSLog(@"%@:%@", lemployeeNameString, self.employeeTextField.text);
}
结果:2012-05-02 08:42:50.137 rbTimesheet[7855:11303] Bob Smith:(null)
-(void)changeDateViewController:(ChooseDateViewController *)ntvc didChooseDate:(NSDate *)lDate
{
NSDateFormatter *df = [[NSDateFormatter alloc] init];
df.dateStyle = NSDateFormatterMediumStyle;
self.datelabel.text = [NSString stringWithFormat:@"%@",
[df stringFromDate:lDate]];
[self dismissModalViewControllerAnimated:YES];
}