还有如何解决“预期”;在'{'token?代码之前(来自xcode 3.2.3)
- (void)viewDidUnload {
self.cheatName = nil;
self.description = nil;
}
两个错误都在第一行
- (void)viewDidLoad {
[super viewDidLoad];
[self.titleLabel setText:self.title];
[self.descriptionLabel setText:self.description];
float textHeight = [MLUtils calculateHeightOfTextFromWidth:self.description : descriptionLabel.font :descriptionLabel.frame.size.width :UILineBreakModeWordWrap];
CGRect frame = descriptionLabel.frame;
frame.size.height = textHeight;
descriptionLabel.frame = frame;
CGSize contentSize = descriptionScrollView.contentSize;
contentSize.height = textHeight;
descriptionScrollView.contentSize = contentSize;
- (void)viewDidUnload {
self.cheatName = nil;
self.description = nil;
}
答案 0 :(得分:6)
你错过了一个结束括号:
- (void)viewDidLoad {
[super viewDidLoad];
[self.titleLabel setText:self.title];
[self.descriptionLabel setText:self.description];
float textHeight = [MLUtils calculateHeightOfTextFromWidth:self.description : descriptionLabel.font :descriptionLabel.frame.size.width :UILineBreakModeWordWrap];
CGRect frame = descriptionLabel.frame;
frame.size.height = textHeight;
descriptionLabel.frame = frame;
CGSize contentSize = descriptionScrollView.contentSize;
contentSize.height = textHeight;
descriptionScrollView.contentSize = contentSize;
} // <-- HERE
- (void)viewDidUnload {
self.cheatName = nil;
self.description = nil;
}
其次,我不确定这条线是否有效:
float textHeight = [MLUtils calculateHeightOfTextFromWidth:self.description : descriptionLabel.font :descriptionLabel.frame.size.width :UILineBreakModeWordWrap];
我认为你必须添加参数名称,如(虚构名称!):
float textHeight = [MLUtils calculateHeightOfTextFromWidth:self.description font: descriptionLabel.font width:descriptionLabel.frame.size.width whatever:UILineBreakModeWordWrap];
答案 1 :(得分:0)
通常这意味着您在该行之上的某处出现错误。或者错放了{}。