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 trialRami Ammoun
7,468 PointsTransferring information between views stopped after I applied the changes of this lesson.
I was trying to resolve this for almost 3 hours now.. The code is exactly the same, the outlets, gesture identifier, and all what I checked in main.Storyboard is the same.
When I tap the image in PlaylistMasterViewController it moves to the PlaylistDetailViewController but with no passed information.
Any one had this problem before? Suggestions please!
Here is my code in PlaylistDetailViewController.m file:
#import "PlaylistMasterViewController.h"
#import "PlaylistDetailViewController.h"
#import "Playlist.h"
@interface PlaylistMasterViewController ()
@end
@implementation PlaylistMasterViewController
- (void)viewDidLoad {
[super viewDidLoad];
for (NSUInteger index =0; index < self.playlistImageViews.count; index++) {
Playlist *playlist = [[Playlist alloc] initWithIndex:index];
UIImageView *playlistImageView = self.playlistImageViews[index];
playlistImageView.image = playlist.playlistIcon;
playlistImageView.backgroundColor = playlist.backgroundColor;
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"showPlaylistDetail"]) {
UIImageView *playlistImageView = (UIImageView *)[sender view];
if ([self.playlistImageViews containsObject:playlistImageView]) {
NSUInteger index = [self.playlistImageViews indexOfObject:playlistImageView];
PlaylistDetailViewController *playlistDetailController = (PlaylistDetailViewController *)segue.destinationViewController;
playlistDetailController.playlist = [[Playlist alloc] initWithIndex:index];
}
}
}
- (IBAction)showPlaylistDetail:(id)sender {
[self performSegueWithIdentifier:@"showPlaylistDetail" sender:sender];
}
@end
3 Answers
arshin
17,770 PointsPrecise Steps to Solve this problem: 1) Proceed to Main.Storyboard file. 2) In the navigator, select 'Tap Gesture Recognizer' 3) In the Utilities panel, visit the Connections Inspector. 4) Under the Referencing outlet Collections, close (x) the { gesture recognizer -> view }. 5) Drag the empty circle, located under the 'Referencing Collections, to the image view (yellow icon); a small pop up menu will appear, wherein 'Gesture Recognizer' option must be selected.
Finish! Verify by Running the App! :D
Rami Ammoun
7,468 PointsFound the solution, finally!!!!!!!!!!!!! in the main.storyboard, I clicked the placeholder image --> in connections inspector, I deleted the gesture recognizer
Then I re added the Tap Gesture recognizer to the place holder image by drag drop method
Chris Longe
5,613 PointsI had the same issue. Once I applied changes in this video the data no longer passes to the PlaylistDetailViewController. My fix was a bit different then yours though. I noticed in the Connections Inspector that my Tap Gesture Recognizer had a reference to both the placeholder and the view. Removing the reference to View and making sure only placeholder was connected fixed it for me.
Caleb Kleveter
Treehouse Moderator 37,862 PointsHow did you re-attach it to your code?
Ryan Summe
4,618 PointsI had the same problem. Thank you for this thread...I couldn't fix it with what you said, but I started messing around with a number of things and poof it works now. Mine now works with the "Referencing Outlet Collections" gestureRecognizers linked to placeholder. Why is mine Referencing Outlet Collections and the screenshot above just Outlet Collections?
Is an update in Xcode to blame for this tutorial? seems a number of us ran into this issue while still following the tutorial. That or a step was missed or put out of order.