-3

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;

}
Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
Bob
  • 41
  • 1
  • 8

2 Answers2

6

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];
Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
  • Then I get an error later down the line: - (void)viewDidUnload { self.cheatName = nil; self.description = nil; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)dealloc { [titleLabel release]; [descriptionLabel release]; [descriptionScrollView release]; [cheatName release]; [description release]; [super dealloc]; } } @end – Bob Aug 20 '10 at 23:45
  • the error is at the two brackets at the end - it says I need a "(" before "}" token If I remove it, then there are a whole load more errors that have no meaning to the project (like 35 or so) – Bob Aug 20 '10 at 23:48
  • 1
    @nolimitsplayer: It is hard to tell without the the whole code. I suggest to go through your code, fold the methods and see if the folding is done correctly. Verify that the number of opening and closing brackets are the same, etc. – Felix Kling Aug 20 '10 at 23:51
  • Can I upload the file to you? – Bob Aug 20 '10 at 23:55
  • Wait no it is like 65MB for a simple application (WTF) I don't know what to do. All of the brackets are where they should be, etc. What can I do? I don't feel like fixing all of it over again. – Bob Aug 20 '10 at 23:57
  • The syntax `[o foo:a :b :c]` is actually valid, but it refers to the selector `foo:::` instead of `foo:bar:baz:`. – tc. Aug 20 '10 at 23:59
  • What does that mean? I'm pretty much done with the project. (Unless someone wants to work on it with me) – Bob Aug 21 '10 at 00:02
  • http://pastebin.com/g0sBYD2J The double brackets right before the viewdidunload thing is where the trouble is. – Bob Aug 21 '10 at 00:03
  • @nolimitsplayer: Now you have two brackets, in line 27 and 28. Remove one. – Felix Kling Aug 21 '10 at 05:39
  • If I do there is a massive error breaking out, with referencing weird files: http://imgur.com/5c3tQ.png – Bob Aug 21 '10 at 06:30
0

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

Zepplock
  • 28,655
  • 4
  • 35
  • 50