【发布时间】:2012-01-02 06:27:18
【问题描述】:
下面是一些我遇到问题的代码:
//format the date to a string for echoing it
NSDateFormatter* formattedDate = [[NSDateFormatter alloc] init];
[formattedDate setDateStyle:NSDateFormatterLongStyle]; //now myFormatted is set to a long style
NSString* dateForOutput = [formattedDate stringFromDate:self.datePickerOutlet.date];
//also now need to set the "you began on" text to the newly chosen date
[self.startDate setText:@"You started on: %@", dateForOutput];
给出的错误是:“方法调用的参数太多,预期为 1,有 2”
我不明白为什么它说我正在尝试传递两种方法。 如果我很愚蠢,我尝试执行以下操作,但它仍然给了我一个错误:
//format the date to a string for echoing it
NSDateFormatter* formattedDate = [[NSDateFormatter alloc] init];
[formattedDate setDateStyle:NSDateFormatterLongStyle]; //now myFormatted is set to a long style
NSString* dateForOutput = [formattedDate stringFromDate:self.datePickerOutlet.date];
//also now need to set the "you began on" text to the newly chosen date
NSString *foobar = @"You started on: %@", dateForOutput;
[self.startDate setText:foobar];
给出的错误:“接口类型不能静态分配”
坦率地说,我不知道为什么它给了我这个错误...一些帮助将不胜感激。 这可能只是我出于某种原因看不到的小东西=/
干杯, 马特
【问题讨论】:
-
您是否为日期选择器和 UIlabel 创建了属性..?
标签: iphone ios cocoa-touch ios5