This repository has been archived by the owner on Mar 26, 2021. It is now read-only.
forked from nytimes/NYTPhotoViewer
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c4cf7f
commit f3fd0b8
Showing
13 changed files
with
303 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// NYTInterstitialViewController.h | ||
// NYTPhotoViewer | ||
// | ||
// Created by Howarth, Craig on 4/17/18. | ||
// Copyright © 2018 NYTimes. All rights reserved. | ||
// | ||
|
||
@import UIKit; | ||
#import "NYTPhotoViewerContainer.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
* The view controller controlling the display of a interstitial view. | ||
*/ | ||
@interface NYTInterstitialViewController : UIViewController <NYTPhotoViewerContainer> | ||
|
||
/** | ||
* The designated initializer that takes an interstitial view. | ||
* | ||
* @param view The view object that this view controller manages. | ||
* @param itemIndex The index of this view controller in the photo viewer collection. | ||
* | ||
* @return A fully initialized object. | ||
*/ | ||
- (instancetype)initWithView:(nullable UIView *)view itemIndex:(NSUInteger)itemIndex NS_DESIGNATED_INITIALIZER; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// | ||
// NYTInterstitialViewController.m | ||
// NYTPhotoViewer | ||
// | ||
// Created by Howarth, Craig on 4/17/18. | ||
// Copyright © 2018 NYTimes. All rights reserved. | ||
// | ||
|
||
#import "NYTInterstitialViewController.h" | ||
#import "NYTPhoto.h" | ||
|
||
@interface NYTInterstitialViewController () | ||
|
||
@property (nonatomic, nullable) id <NYTPhoto> photo; | ||
@property (nonatomic, nullable) UIView *interstitialView; | ||
@property (nonatomic) NSUInteger photoViewItemIndex; | ||
|
||
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER; | ||
|
||
@end | ||
|
||
@implementation NYTInterstitialViewController | ||
|
||
#pragma mark - UIViewController | ||
|
||
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { | ||
return [self initWithView:nil itemIndex:0]; | ||
} | ||
|
||
- (instancetype)initWithCoder:(NSCoder *)aDecoder { | ||
self = [super initWithCoder:aDecoder]; | ||
|
||
if (self) { | ||
[self commonInitWithView:nil itemIndex:0]; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
|
||
[self.view addSubview:self.interstitialView]; | ||
self.interstitialView.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds)); | ||
} | ||
|
||
- (void)viewWillLayoutSubviews { | ||
[super viewWillLayoutSubviews]; | ||
|
||
self.interstitialView.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds)); | ||
} | ||
|
||
- (BOOL)prefersHomeIndicatorAutoHidden { | ||
return YES; | ||
} | ||
|
||
#pragma mark - NYTPhotoViewController | ||
|
||
- (instancetype)initWithView:(UIView *)interstitialView itemIndex:(NSUInteger)itemIndex { | ||
self = [super initWithNibName:nil bundle:nil]; | ||
|
||
if (self) { | ||
[self commonInitWithView:interstitialView itemIndex:itemIndex]; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (void)commonInitWithView:(UIView *)interstitialView itemIndex:(NSUInteger)itemIndex { | ||
_photo = nil; | ||
_photoViewItemIndex = itemIndex; | ||
_interstitialView = interstitialView; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.