好的,所以基本上我试图将标签链接到 XCode 4.6.2 中的代码块。我使用设计器链接它,但无论我把它放在哪里,它都会给我这个错误消息。我是 xcode 的新手,觉得这应该是一个简单的修复。感谢您的反馈/
(void)updateLabel {
@property (weak, nonatomic) IBOutlet UILabel *Timer;
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
int units = NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
NSDateComponents *components = [calendar components:units fromDate:[NSDate date] toDate:destinationDate options:0];
[dateLabel setText:[NSString stringWithFormat:@"%d%c %d%c %d%c %d%c %d%c", [components month], 'M', [components day], 'D', [components hour], 'H', [components minute], 'M', [components second], 'S']];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
destinationDate = [[NSDate dateWithTimeIntervalSince1970:1383652800] retain];
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateLabel) userInfo:nil repeats:YES];
}