任何人都知道如何解决“viewDidUnload 未声明”问题问题?

发布于 2024-09-15 04:17:32 字数 868 浏览 7 评论 0原文

以及如何解决“预期的”;“在 '{' 标记之前?下面的代码(来自 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;

}

And also how to solve an "expected ';' before '{' token? code below (from xcode 3.2.3)

- (void)viewDidUnload {

    self.cheatName = nil;

    self.description = nil;

}

Both errors are in the first line

- (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;

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绝情姑娘 2024-09-22 04:17:32

您缺少右括号:

- (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];

Your are missing a closing bracket:

- (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;

}

Second, I am not sure whether this line is valid:

float textHeight = [MLUtils calculateHeightOfTextFromWidth:self.description : descriptionLabel.font :descriptionLabel.frame.size.width :UILineBreakModeWordWrap];

I think you have to add the parameter names like (fictive names!):

float textHeight = [MLUtils calculateHeightOfTextFromWidth:self.description font: descriptionLabel.font width:descriptionLabel.frame.size.width whatever:UILineBreakModeWordWrap];
初相遇 2024-09-22 04:17:32

通常这意味着您在该线上方的某个位置有错误。或者放错了{}。

usually that means that you have an error somewhere above that line. Or misplaced { }.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文