MWPhotoBrowserPrivate.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. //
  2. // MWPhotoBrowser_Private.h
  3. // MWPhotoBrowser
  4. //
  5. // Created by Michael Waterfall on 08/10/2013.
  6. //
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <AVKit/AVKit.h>
  10. #import <MediaPlayer/MediaPlayer.h>
  11. #import <MBProgressHUD/MBProgressHUD.h>
  12. #import "MWZoomingScrollView.h"
  13. // Declare private methods of browser
  14. @interface MWPhotoBrowser () {
  15. // Data
  16. NSUInteger _photoCount;
  17. NSMutableArray *_photos;
  18. NSMutableArray *_thumbPhotos;
  19. NSArray *_fixedPhotosArray; // Provided via init
  20. // Views
  21. UIScrollView *_pagingScrollView;
  22. // Paging & layout
  23. NSMutableSet *_visiblePages, *_recycledPages;
  24. NSUInteger _currentPageIndex;
  25. NSUInteger _previousPageIndex;
  26. CGRect _previousLayoutBounds;
  27. NSUInteger _pageIndexBeforeRotation;
  28. // Navigation & controls
  29. NSTimer *_controlVisibilityTimer;
  30. MBProgressHUD *_progressHUD;
  31. // Appearance
  32. BOOL _previousNavBarHidden;
  33. BOOL _previousNavBarTranslucent;
  34. UIBarStyle _previousNavBarStyle;
  35. UIColor *_previousNavBarTintColor;
  36. UIColor *_previousNavBarBarTintColor;
  37. UIBarButtonItem *_previousViewControllerBackButton;
  38. UIImage *_previousNavigationBarBackgroundImageDefault;
  39. UIImage *_previousNavigationBarBackgroundImageLandscapePhone;
  40. // Video
  41. AVPlayerViewController *_currentVideoPlayerViewController;
  42. AVPlayerItem *_currentVideoPlayerItem;
  43. NSUInteger _currentVideoIndex;
  44. UIActivityIndicatorView *_currentVideoLoadingIndicator;
  45. // Misc
  46. BOOL _hasBelongedToViewController;
  47. BOOL _isVCBasedStatusBarAppearance;
  48. BOOL _statusBarShouldBeHidden;
  49. BOOL _displayActionButton;
  50. BOOL _performingLayout;
  51. BOOL _rotating;
  52. BOOL _viewIsActive; // active as in it's in the view heirarchy
  53. BOOL _didSavePreviousStateOfNavBar;
  54. BOOL _skipNextPagingScrollViewPositioning;
  55. BOOL _viewHasAppearedInitially;
  56. }
  57. // Properties
  58. @property (nonatomic) UIActivityViewController *activityViewController;
  59. // Layout
  60. - (void)layoutVisiblePages;
  61. - (void)performLayout;
  62. - (BOOL)presentingViewControllerPrefersStatusBarHidden;
  63. // Paging
  64. - (void)tilePages;
  65. - (BOOL)isDisplayingPageForIndex:(NSUInteger)index;
  66. - (MWZoomingScrollView *)pageDisplayedAtIndex:(NSUInteger)index;
  67. - (MWZoomingScrollView *)pageDisplayingPhoto:(id<MWPhoto>)photo;
  68. - (MWZoomingScrollView *)dequeueRecycledPage;
  69. - (void)configurePage:(MWZoomingScrollView *)page forIndex:(NSUInteger)index;
  70. - (void)didStartViewingPageAtIndex:(NSUInteger)index;
  71. // Frames
  72. - (CGRect)frameForPagingScrollView;
  73. - (CGRect)frameForPageAtIndex:(NSUInteger)index;
  74. - (CGSize)contentSizeForPagingScrollView;
  75. - (CGPoint)contentOffsetForPageAtIndex:(NSUInteger)index;
  76. - (CGRect)frameForToolbarAtOrientation:(UIInterfaceOrientation)orientation;
  77. - (CGRect)frameForCaptionView:(MWCaptionView *)captionView atIndex:(NSUInteger)index;
  78. - (CGRect)frameForSelectedButton:(UIButton *)selectedButton atIndex:(NSUInteger)index;
  79. // Navigation
  80. - (void)updateNavigation;
  81. - (void)jumpToPageAtIndex:(NSUInteger)index animated:(BOOL)animated;
  82. - (void)gotoPreviousPage;
  83. - (void)gotoNextPage;
  84. // Controls
  85. - (void)cancelControlHiding;
  86. - (void)hideControlsAfterDelay;
  87. - (void)setControlsHidden:(BOOL)hidden animated:(BOOL)animated permanent:(BOOL)permanent;
  88. - (void)toggleControls;
  89. - (BOOL)areControlsHidden;
  90. // Data
  91. - (NSUInteger)numberOfPhotos;
  92. - (id<MWPhoto>)photoAtIndex:(NSUInteger)index;
  93. - (UIImage *)imageForPhoto:(id<MWPhoto>)photo;
  94. - (BOOL)photoIsSelectedAtIndex:(NSUInteger)index;
  95. - (void)setPhotoSelected:(BOOL)selected atIndex:(NSUInteger)index;
  96. - (void)loadAdjacentPhotosIfNecessary:(id<MWPhoto>)photo;
  97. - (void)releaseAllUnderlyingPhotos:(BOOL)preserveCurrent;
  98. @end