iOS: Storyboard CollectionView segue nicht ausgelöst wird

Ich habe eine UICollectionView controller eingebettet ist, einen navigation-controller. Der collectionView listet die Projekte auf, und jede Zelle soll segue zu einem ProjectDetail Bildschirm.

Habe ich einfach nicht bekommen kann den Wechsel auslösen. Wenn ich einfach eine Taste auf der nav-bar-und-hook-up ein übergang ins detail, es funktioniert. Aber die Auslösung von meinem CollectionView Zelle nicht.

Hier ist, was das storyboard sieht so aus: http://cl.ly/RfcM ich habe ein segue hakte sich aus der CollectionViewCell der ProjectDetailViewController

Hier ist der relevante code in meiner ProjectDetailViewController:

@interface ProjectCollectionViewController () {
    NSArray *feedPhotos;
    Projects *projects;
}

@end

@implementation ProjectCollectionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.collectionView registerClass:[FeedViewCell class] forCellWithReuseIdentifier:@"cell"];
    [self loadData];

}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"selected %d", indexPath.row);
    Project *project = [projects getProject:indexPath.row];
    NSLog(@"project = %@", project);
}

- (void)loadData {

    [self.projectLoader loadFeed:self.username
                       onSuccess:^(Projects *loadedProjects) {
                           NSLog(@"view did load on success :  projects %@", loadedProjects);
                           projects = loadedProjects;

                           [self.collectionView reloadData];
                       }
                       onFailure:^(NSError *error) {
                           [self handleConnectionError:error];
                       }];
}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
   return projects.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *identifier = @"cell";
    FeedViewCell *cell = (FeedViewCell *) [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
    cell.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:1.0 alpha:1.0];
    UIImageView *cellImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    Project *project = [projects getProject:indexPath.row];
    NSString *imageUrl = [project coverPhotoUrl:200 forHeight:200];
    NSLog(@"imageurl =>%@", imageUrl);
    if (imageUrl) {
        [cellImageView setImageWithURL:[NSURL URLWithString:imageUrl]];
    }
    [cell addSubview:cellImageView];
    cell.imageView = cellImageView;
    return cell;
}

Ich vermute das problem liegt irgendwo im, wie ich Sie anschließen die Zellen an die CollectionView.

Jede Hilfe wäre sehr geschätzt werden!

InformationsquelleAutor phil swenson | 2013-09-28
Schreibe einen Kommentar