好吧,所以基本上我试图将标签链接到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];
}
错误消息是什么???? –
(但在方法定义中不允许使用“@ property”语句,实际上甚至不应该在.m文件中。) –
(实例/属性名称应以小写字母开头。) –