Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 1 #604

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Pod/Classes/MWPhotoBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
@property (nonatomic) BOOL enableSwipeToDismiss;
@property (nonatomic) BOOL startOnGrid;
@property (nonatomic) BOOL autoPlayOnAppear;
@property (nonatomic) BOOL hidesControlsOnSwipe;
@property (nonatomic) BOOL enableHideTimer;
@property (nonatomic) NSUInteger delayToHideElements;
@property (nonatomic, readonly) NSUInteger currentIndex;

Expand Down
16 changes: 11 additions & 5 deletions Pod/Classes/MWPhotoBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ - (void)_initialisation {
_currentGridContentOffset = CGPointMake(0, CGFLOAT_MAX);
_didSavePreviousStateOfNavBar = NO;
self.automaticallyAdjustsScrollViewInsets = NO;

_hidesControlsOnSwipe = YES;
_enableHideTimer = YES;
// Listen for MWPhoto notifications
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleMWPhotoLoadingDidEndNotification:)
Expand Down Expand Up @@ -355,7 +356,8 @@ - (void)viewWillAppear:(BOOL)animated {
[self setNavBarAppearance:animated];

// Update UI
[self hideControlsAfterDelay];
if(_enableHideTimer)
[self hideControlsAfterDelay];

// Initial appearance
if (!_viewHasAppearedInitially) {
Expand Down Expand Up @@ -577,7 +579,8 @@ - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInte
_currentPageIndex = _pageIndexBeforeRotation;

// Delay control holding
[self hideControlsAfterDelay];
if(_enableHideTimer)
[self hideControlsAfterDelay];

// Layout
[self layoutVisiblePages];
Expand Down Expand Up @@ -1067,7 +1070,9 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
// Hide controls when dragging begins
[self setControlsHidden:YES animated:YES permanent:NO];
if (_hidesControlsOnSwipe) {
[self setControlsHidden:YES animated:YES permanent:NO];
}
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
Expand Down Expand Up @@ -1129,7 +1134,8 @@ - (void)jumpToPageAtIndex:(NSUInteger)index animated:(BOOL)animated {
}

// Update timer to give more time
[self hideControlsAfterDelay];
if (_enableHideTimer)
[self hideControlsAfterDelay];

}

Expand Down