Skip to content

Commit

Permalink
Fixed custom asset view controller class handling
Browse files Browse the repository at this point in the history
  • Loading branch information
davbeck committed Apr 3, 2015
1 parent e136379 commit 1127d80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Pod/Classes/TNKAssetViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@interface TNKAssetViewController : UIViewController

@property (nonatomic, strong) PHAsset *asset;
@property (nonatomic, strong) NSIndexPath *assetIndexPath;


@property (nonatomic, readonly) UIButton *selectButton;
Expand Down
10 changes: 10 additions & 0 deletions Pod/Classes/TNKAssetsDetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ - (void)_refetch {
}
}

- (void)setAssetViewControllerClass:(Class)assetViewControllerClass {
NSAssert([assetViewControllerClass isSubclassOfClass:[TNKAssetViewController class]], @"assetViewControllerClass must be a subclass of TNKAssetViewController");

_assetViewControllerClass = assetViewControllerClass;

NSIndexPath *indexPath = [self.viewControllers.firstObject assetIndexPath];
[self showAssetAtIndexPath:indexPath];
}


#pragma mark - Initialization

Expand Down Expand Up @@ -230,6 +239,7 @@ - (TNKAssetViewController *)_assetViewControllerWithAssetAtIndexPath:(NSIndexPat
objc_setAssociatedObject(next.selectButton, @selector(indexPath), indexPath, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

next.asset = asset;
next.assetIndexPath = indexPath;

return next;
}
Expand Down

0 comments on commit 1127d80

Please sign in to comment.