From 161e7d8440f4853c9f24d636ad4768654dde31aa Mon Sep 17 00:00:00 2001 From: Chris Dzombak Date: Mon, 20 Apr 2015 15:43:51 -0400 Subject: [PATCH] =?UTF-8?q?Rename=20=E2=80=A6didDisplayPhoto=E2=80=A6=20to?= =?UTF-8?q?=20=E2=80=A6didNavigateToPhoto=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This more closely reflects that this delegate method/notification is tightly tied to user interactions. closes #42 --- Example/NYTPhotoViewer-Swift/ViewController.swift | 4 ++-- Example/NYTPhotoViewer/NYTViewController.m | 4 ++-- Pod/Classes/ios/NYTPhotosViewController.h | 4 ++-- Pod/Classes/ios/NYTPhotosViewController.m | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Example/NYTPhotoViewer-Swift/ViewController.swift b/Example/NYTPhotoViewer-Swift/ViewController.swift index 10fd4653..b64d2a85 100644 --- a/Example/NYTPhotoViewer-Swift/ViewController.swift +++ b/Example/NYTPhotoViewer-Swift/ViewController.swift @@ -101,8 +101,8 @@ class ViewController: UIViewController, NYTPhotosViewControllerDelegate { return nil } - func photosViewController(photosViewController: NYTPhotosViewController!, didDisplayPhoto photo: NYTPhoto!, atIndex photoIndex: UInt) { - println("Did Display Photo: \(photo) identifier: \(photoIndex)") + func photosViewController(photosViewController: NYTPhotosViewController!, didNavigateToPhoto photo: NYTPhoto!, atIndex photoIndex: UInt) { + println("Did Navigate To Photo: \(photo) identifier: \(photoIndex)") } func photosViewController(photosViewController: NYTPhotosViewController!, actionCompletedWithActivityType activityType: String!) { diff --git a/Example/NYTPhotoViewer/NYTViewController.m b/Example/NYTPhotoViewer/NYTViewController.m index 3dfe6ccd..e301a4cb 100644 --- a/Example/NYTPhotoViewer/NYTViewController.m +++ b/Example/NYTPhotoViewer/NYTViewController.m @@ -112,8 +112,8 @@ - (NSDictionary *)photosViewController:(NYTPhotosViewController *)photosViewCont return nil; } -- (void)photosViewController:(NYTPhotosViewController *)photosViewController didDisplayPhoto:(id )photo atIndex:(NSUInteger)photoIndex { - NSLog(@"Did Display Photo: %@ identifier: %lu", photo, (unsigned long)photoIndex); +- (void)photosViewController:(NYTPhotosViewController *)photosViewController didNavigateToPhoto:(id )photo atIndex:(NSUInteger)photoIndex { + NSLog(@"Did Navigate To Photo: %@ identifier: %lu", photo, (unsigned long)photoIndex); } - (void)photosViewController:(NYTPhotosViewController *)photosViewController actionCompletedWithActivityType:(NSString *)activityType { diff --git a/Pod/Classes/ios/NYTPhotosViewController.h b/Pod/Classes/ios/NYTPhotosViewController.h index e519df31..2b3c87b6 100644 --- a/Pod/Classes/ios/NYTPhotosViewController.h +++ b/Pod/Classes/ios/NYTPhotosViewController.h @@ -14,7 +14,7 @@ @protocol NYTPhotosViewControllerDelegate; // All notifications will have the `NYTPhotosViewController` instance set as the object. -extern NSString * const NYTPhotosViewControllerDidDisplayPhotoNotification; +extern NSString * const NYTPhotosViewControllerDidNavigateToPhotoNotification; extern NSString * const NYTPhotosViewControllerWillDismissNotification; extern NSString * const NYTPhotosViewControllerDidDismissNotification; @@ -110,7 +110,7 @@ extern NSString * const NYTPhotosViewControllerDidDismissNotification; * @param photo The photo object that was just displayed. * @param photoIndex The index of the photo that was just displayed. */ -- (void)photosViewController:(NYTPhotosViewController *)photosViewController didDisplayPhoto:(id )photo atIndex:(NSUInteger)photoIndex; +- (void)photosViewController:(NYTPhotosViewController *)photosViewController didNavigateToPhoto:(id )photo atIndex:(NSUInteger)photoIndex; /** * Called immediately before the photos view controller is about to start dismissal. This will be the beginning of the interactive panning to dismiss, if it is enabled and performed. diff --git a/Pod/Classes/ios/NYTPhotosViewController.m b/Pod/Classes/ios/NYTPhotosViewController.m index 15b11d99..772ef566 100644 --- a/Pod/Classes/ios/NYTPhotosViewController.m +++ b/Pod/Classes/ios/NYTPhotosViewController.m @@ -16,7 +16,7 @@ #import "NYTPhotosOverlayView.h" #import "NYTPhotoCaptionView.h" -NSString * const NYTPhotosViewControllerDidDisplayPhotoNotification = @"NYTPhotosViewControllerDidDisplayPhotoNotification"; +NSString * const NYTPhotosViewControllerDidNavigateToPhotoNotification = @"NYTPhotosViewControllerDidNavigateToPhotoNotification"; NSString * const NYTPhotosViewControllerWillDismissNotification = @"NYTPhotosViewControllerWillDismissNotification"; NSString * const NYTPhotosViewControllerDidDismissNotification = @"NYTPhotosViewControllerDidDismissNotification"; @@ -371,12 +371,12 @@ - (NYTPhotoViewController *)newPhotoViewControllerForPhoto:(id )photo return nil; } -- (void)didDisplayPhoto:(id )photo { - if ([self.delegate respondsToSelector:@selector(photosViewController:didDisplayPhoto:atIndex:)]) { - [self.delegate photosViewController:self didDisplayPhoto:photo atIndex:[self.dataSource indexOfPhoto:photo]]; +- (void)didNavigateToPhoto:(id )photo { + if ([self.delegate respondsToSelector:@selector(photosViewController:didNavigateToPhoto:atIndex:)]) { + [self.delegate photosViewController:self didNavigateToPhoto:photo atIndex:[self.dataSource indexOfPhoto:photo]]; } - [[NSNotificationCenter defaultCenter] postNotificationName:NYTPhotosViewControllerDidDisplayPhotoNotification object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:NYTPhotosViewControllerDidNavigateToPhotoNotification object:self]; } - (id )currentlyDisplayedPhoto { @@ -439,7 +439,7 @@ - (void)pageViewController:(UIPageViewController *)pageViewController didFinishA [self updateOverlayInformation]; UIViewController *photoViewController = pageViewController.viewControllers.firstObject; - [self didDisplayPhoto:photoViewController.photo]; + [self didNavigateToPhoto:photoViewController.photo]; } }