I ended up reworking quite a bit of how I was displaying the data, and managed to get it to work.
Here's the code I used:
CollectionViewController.h
#import <UIKit/UIKit.h>
#import "PhotoViewController.h"
#import "CollectionViewCell.h"
@class PhotoViewController;
@interface CollectionViewController : UICollectionViewController <UICollectionViewDataSource, UICollectionViewDelegate>
@property (nonatomic, strong) PhotoViewController *photoViewController;
@end
CollectionViewController.m
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"displayDetail"]) {
PhotoViewController *destViewController = segue.destinationViewController;
NSIndexPath *indexPath = [[self.collectionView indexPathsForSelectedItems] lastObject];
NSString *largeImageURL = [photos objectAtIndex:indexPath.row];
destViewController.imageURL = [NSURL URLWithString:largeImageURL];
}
}
PhotoViewController.h
#import <UIKit/UIKit.h>
#import "CollectionViewController.h"
@interface PhotoViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIImageView *imageView;
@property (strong, nonatomic) NSURL *imageURL;
@end
PhotoViewController.m
#import "PhotoViewController.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "UIImageView+WebCache.h"
@interface PhotoViewController ()
@end
@implementation PhotoViewController
@synthesize imageURL = _imageURL;
@synthesize imageView = _imageView;
#pragma mark - Managing the detail item
- (void)setImageURL:(NSURL *)imageURL
{
if (_imageURL != imageURL)
{
_imageURL = imageURL;
[self configureView];
}
}
- (void)configureView
{
if (self.imageURL)
// NSLog(@"%@", self.imageURL);
{
// NSLog(@"%@", self.imageView);
[self.imageView setImageWithURL:self.imageURL placeholderImage:nil options:SDWebImageProgressiveDownload progress:^(NSInteger receivedSize, NSInteger expectedSize)
{
}
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType)
{
// NSLog(@"%@", image);
}];
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self configureView];
}