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 trialDavid Klein
Courses Plus Student 1,456 PointsPhoto Bomber Extra Credit
Hey guys, i want to set the avatar picture in detailViewController but the image is not appear in avatar UIImageView. here is my code.
UIImage *zero = [UIImage imageNamed:[self.photo valueForKeyPath:@"user.profile_picture"]];
self.avatarImageView = [[UIImageView alloc] initWithImage:zero];
2 Answers
David Klein
Courses Plus Student 1,456 Pointsnevermind guys, i found a solution . below is my solution code. u guys also can add your code too.
UIImage *zero = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[self.photo valueForKeyPath:@"user.profile_picture"]]]];
[self.avatarImageView setImage:zero];
Arsene Lavaux
4,342 PointsIs there a way to use the avatarForPhoto method added by Amit in the THPhotoController to achieve this in the same way the imageForPhoto method was used to fetch the image before placing it in the DetailViewController?
I am a beginner, struggling a bit on this and wouldn't want to copy your solution before exploring any possibilities.
Thanks!