MWPhotoBrowserPrivate.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 "MBProgressHUD.h"
  10. #import "MWGridViewController.h"
  11. #import "MWZoomingScrollView.h"
  12. // Declare private methods of browser
  13. @interface MWPhotoBrowser () {
  14. // Data
  15. NSUInteger _photoCount;
  16. NSMutableArray *_photos;
  17. NSMutableArray *_thumbPhotos;
  18. NSArray *_depreciatedPhotoData; // Depreciated
  19. // Views
  20. UIScrollView *_pagingScrollView;
  21. // Paging & layout
  22. NSMutableSet *_visiblePages, *_recycledPages;
  23. NSUInteger _currentPageIndex;
  24. NSUInteger _previousPageIndex;
  25. CGRect _previousLayoutBounds;
  26. NSUInteger _pageIndexBeforeRotation;
  27. // Navigation & controls
  28. UIToolbar *_toolbar;
  29. NSTimer *_controlVisibilityTimer;
  30. UIBarButtonItem *_previousButton, *_nextButton, *_actionButton, *_doneButton;
  31. MBProgressHUD *_progressHUD;
  32. UIActionSheet *_actionsSheet;
  33. // Grid
  34. MWGridViewController *_gridController;
  35. UIBarButtonItem *_gridPreviousLeftNavItem;
  36. UIBarButtonItem *_gridPreviousRightNavItem;
  37. // Appearance
  38. BOOL _previousNavBarHidden;
  39. BOOL _previousNavBarTranslucent;
  40. UIBarStyle _previousNavBarStyle;
  41. UIStatusBarStyle _previousStatusBarStyle;
  42. UIColor *_previousNavBarTintColor;
  43. UIColor *_previousNavBarBarTintColor;
  44. UIBarButtonItem *_previousViewControllerBackButton;
  45. UIImage *_previousNavigationBarBackgroundImageDefault;
  46. UIImage *_previousNavigationBarBackgroundImageLandscapePhone;
  47. // Misc
  48. BOOL _hasBelongedToViewController;
  49. BOOL _isVCBasedStatusBarAppearance;
  50. BOOL _statusBarShouldBeHidden;
  51. BOOL _displayActionButton;
  52. BOOL _leaveStatusBarAlone;
  53. BOOL _performingLayout;
  54. BOOL _rotating;
  55. BOOL _viewIsActive; // active as in it's in the view heirarchy
  56. BOOL _didSavePreviousStateOfNavBar;
  57. BOOL _skipNextPagingScrollViewPositioning;
  58. BOOL _viewHasAppearedInitially;
  59. CGPoint _currentGridContentOffset;
  60. }
  61. // Properties
  62. @property (nonatomic) UIActivityViewController *activityViewController;
  63. // Layout
  64. - (void)layoutVisiblePages;
  65. - (void)performLayout;
  66. - (BOOL)presentingViewControllerPrefersStatusBarHidden;
  67. // Nav Bar Appearance
  68. - (void)setNavBarAppearance:(BOOL)animated;
  69. - (void)storePreviousNavBarAppearance;
  70. - (void)restorePreviousNavBarAppearance:(BOOL)animated;
  71. // Paging
  72. - (void)tilePages;
  73. - (BOOL)isDisplayingPageForIndex:(NSUInteger)index;
  74. - (MWZoomingScrollView *)pageDisplayedAtIndex:(NSUInteger)index;
  75. - (MWZoomingScrollView *)pageDisplayingPhoto:(id<MWPhoto>)photo;
  76. - (MWZoomingScrollView *)dequeueRecycledPage;
  77. - (void)configurePage:(MWZoomingScrollView *)page forIndex:(NSUInteger)index;
  78. - (void)didStartViewingPageAtIndex:(NSUInteger)index;
  79. // Frames
  80. - (CGRect)frameForPagingScrollView;
  81. - (CGRect)frameForPageAtIndex:(NSUInteger)index;
  82. - (CGSize)contentSizeForPagingScrollView;
  83. - (CGPoint)contentOffsetForPageAtIndex:(NSUInteger)index;
  84. - (CGRect)frameForToolbarAtOrientation:(UIInterfaceOrientation)orientation;
  85. - (CGRect)frameForCaptionView:(MWCaptionView *)captionView atIndex:(NSUInteger)index;
  86. - (CGRect)frameForSelectedButton:(UIButton *)selectedButton atIndex:(NSUInteger)index;
  87. // Navigation
  88. - (void)updateNavigation;
  89. - (void)jumpToPageAtIndex:(NSUInteger)index animated:(BOOL)animated;
  90. - (void)gotoPreviousPage;
  91. - (void)gotoNextPage;
  92. // Grid
  93. - (void)showGrid:(BOOL)animated;
  94. - (void)hideGrid;
  95. // Controls
  96. - (void)cancelControlHiding;
  97. - (void)hideControlsAfterDelay;
  98. - (void)setControlsHidden:(BOOL)hidden animated:(BOOL)animated permanent:(BOOL)permanent;
  99. - (void)toggleControls;
  100. - (BOOL)areControlsHidden;
  101. // Data
  102. - (NSUInteger)numberOfPhotos;
  103. - (id<MWPhoto>)photoAtIndex:(NSUInteger)index;
  104. - (id<MWPhoto>)thumbPhotoAtIndex:(NSUInteger)index;
  105. - (UIImage *)imageForPhoto:(id<MWPhoto>)photo;
  106. - (BOOL)photoIsSelectedAtIndex:(NSUInteger)index;
  107. - (void)setPhotoSelected:(BOOL)selected atIndex:(NSUInteger)index;
  108. - (void)loadAdjacentPhotosIfNecessary:(id<MWPhoto>)photo;
  109. - (void)releaseAllUnderlyingPhotos:(BOOL)preserveCurrent;
  110. // Actions
  111. - (void)savePhoto;
  112. - (void)copyPhoto;
  113. - (void)emailPhoto;
  114. @end