Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPeter Fazekas
896 Pointsim stuck at the ios development crystal ball app challenge 3rd objective
this is my code and it still says an error please help
import "THViewController.h"
@implementation THViewController
- (void)viewDidLoad { [super viewDidLoad];
self.quotes =[[NSArray alloc] initWithObjects: @"Haters gonna hate", @"Life is simple, not easy", @"Winners never quit, quitters never win", nil];
self.quoteLabel = [self.quote objectAtIndex:1];
}
@end
2 Answers
Mohammad Baqer
4,260 Pointsyou should add the dot "text" property, to be like this :
self.quoteLabel.text = [self.quote objectAtIndex:1];
because you code will make the label itself a string which will make the app crashes, you should change the text of the label instead
Kristen Law
16,244 PointsYou want to assign something to the text
of the UILabel
, so you should use self.quoteLabel.text
. Also, make sure you are calling objectAtIndex
on self.quotes
rather than self.quote
.
See below:
self.quoteLabel.text = [self.quotes objectAtIndex:1];