From faa027ebece2861462813a8c7052938d62949b94 Mon Sep 17 00:00:00 2001 From: Mayank Patel Date: Wed, 16 Dec 2015 12:23:25 +0530 Subject: [PATCH 1/6] Added White color background to Browser * Added white background ti browser --- Pod/Classes/MWPhotoBrowser.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pod/Classes/MWPhotoBrowser.m b/Pod/Classes/MWPhotoBrowser.m index 2e53044d1..b7545cca5 100644 --- a/Pod/Classes/MWPhotoBrowser.m +++ b/Pod/Classes/MWPhotoBrowser.m @@ -143,7 +143,7 @@ - (void)viewDidLoad { if (!_enableGrid) _startOnGrid = NO; // View - self.view.backgroundColor = [UIColor blackColor]; + self.view.backgroundColor = [UIColor whiteColor]; self.view.clipsToBounds = YES; // Setup paging scrolling view From 2e9838a958edbb1b41ca877a1c026cb63038f86d Mon Sep 17 00:00:00 2001 From: mpatel Date: Wed, 16 Dec 2015 14:24:27 +0530 Subject: [PATCH 2/6] * Changes background of MWPhotoBrowser view * Disable Vertical Scroll * Added Tint color of Navigation Bar and Toolbar --- Pod/Classes/MWPhotoBrowser.m | 623 ++++++++++++++++++----------------- 1 file changed, 314 insertions(+), 309 deletions(-) diff --git a/Pod/Classes/MWPhotoBrowser.m b/Pod/Classes/MWPhotoBrowser.m index b7545cca5..44d681831 100644 --- a/Pod/Classes/MWPhotoBrowser.m +++ b/Pod/Classes/MWPhotoBrowser.m @@ -31,26 +31,26 @@ - (id)init { - (id)initWithDelegate:(id )delegate { if ((self = [self init])) { _delegate = delegate; - } - return self; + } + return self; } - (id)initWithPhotos:(NSArray *)photosArray { - if ((self = [self init])) { - _fixedPhotosArray = photosArray; - } - return self; + if ((self = [self init])) { + _fixedPhotosArray = photosArray; + } + return self; } - (id)initWithCoder:(NSCoder *)decoder { - if ((self = [super initWithCoder:decoder])) { + if ((self = [super initWithCoder:decoder])) { [self _initialisation]; - } - return self; + } + return self; } - (void)_initialisation { - + // Defaults NSNumber *isVCBasedStatusBarAppearanceNum = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIViewControllerBasedStatusBarAppearance"]; if (isVCBasedStatusBarAppearanceNum) { @@ -81,13 +81,13 @@ - (void)_initialisation { _currentGridContentOffset = CGPointMake(0, CGFLOAT_MAX); _didSavePreviousStateOfNavBar = NO; self.automaticallyAdjustsScrollViewInsets = NO; - + // Listen for MWPhoto notifications [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleMWPhotoLoadingDidEndNotification:) name:MWPHOTO_LOADING_DID_END_NOTIFICATION object:nil]; - + } - (void)dealloc { @@ -121,52 +121,52 @@ - (void)releaseAllUnderlyingPhotos:(BOOL)preserveCurrent { - (void)didReceiveMemoryWarning { - // Release any cached data, images, etc that aren't in use. + // Release any cached data, images, etc that aren't in use. [self releaseAllUnderlyingPhotos:YES]; - [_recycledPages removeAllObjects]; - - // Releases the view if it doesn't have a superview. + [_recycledPages removeAllObjects]; + + // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; - + } #pragma mark - View Loading // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { - + // Validate grid settings if (_startOnGrid) _enableGrid = YES; if (_enableGrid) { _enableGrid = [_delegate respondsToSelector:@selector(photoBrowser:thumbPhotoAtIndex:)]; } if (!_enableGrid) _startOnGrid = NO; - - // View - self.view.backgroundColor = [UIColor whiteColor]; + + // View + self.view.backgroundColor = [UIColor whiteColor]; self.view.clipsToBounds = YES; - - // Setup paging scrolling view - CGRect pagingScrollViewFrame = [self frameForPagingScrollView]; - _pagingScrollView = [[UIScrollView alloc] initWithFrame:pagingScrollViewFrame]; - _pagingScrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - _pagingScrollView.pagingEnabled = YES; - _pagingScrollView.delegate = self; - _pagingScrollView.showsHorizontalScrollIndicator = NO; - _pagingScrollView.showsVerticalScrollIndicator = NO; - _pagingScrollView.backgroundColor = [UIColor blackColor]; + + // Setup paging scrolling view + CGRect pagingScrollViewFrame = [self frameForPagingScrollView]; + _pagingScrollView = [[UIScrollView alloc] initWithFrame:pagingScrollViewFrame]; + _pagingScrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + _pagingScrollView.pagingEnabled = YES; + _pagingScrollView.delegate = self; + _pagingScrollView.showsHorizontalScrollIndicator = NO; + _pagingScrollView.showsVerticalScrollIndicator = NO; + _pagingScrollView.backgroundColor = [UIColor whiteColor]; _pagingScrollView.contentSize = [self contentSizeForPagingScrollView]; - [self.view addSubview:_pagingScrollView]; - + [self.view addSubview:_pagingScrollView]; + // Toolbar _toolbar = [[UIToolbar alloc] initWithFrame:[self frameForToolbarAtOrientation:self.interfaceOrientation]]; - _toolbar.tintColor = [UIColor whiteColor]; - _toolbar.barTintColor = nil; + _toolbar.tintColor = [UIColor blackColor]; + _toolbar.barTintColor = [UIColor whiteColor]; [_toolbar setBackgroundImage:nil forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault]; [_toolbar setBackgroundImage:nil forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsLandscapePhone]; _toolbar.barStyle = UIBarStyleBlackTranslucent; _toolbar.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth; - + // Toolbar Items if (self.displayNavArrows) { NSString *arrowPathFormat = @"MWPhotoBrowser.bundle/UIBarButtonItemArrow%@"; @@ -178,32 +178,32 @@ - (void)viewDidLoad { if (self.displayActionButton) { _actionButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(actionButtonPressed:)]; } - + // Update [self reloadData]; - + // Swipe to dismiss if (_enableSwipeToDismiss) { UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(doneButtonPressed:)]; swipeGesture.direction = UISwipeGestureRecognizerDirectionDown | UISwipeGestureRecognizerDirectionUp; [self.view addGestureRecognizer:swipeGesture]; } - - // Super + + // Super [super viewDidLoad]; - + } - (void)performLayout { - + // Setup _performingLayout = YES; NSUInteger numberOfPhotos = [self numberOfPhotos]; - - // Setup pages + + // Setup pages [_visiblePages removeAllObjects]; [_recycledPages removeAllObjects]; - + // Navigation buttons if ([self.navigationController.viewControllers objectAtIndex:0] == self) { // We're first on stack so show done button @@ -283,20 +283,20 @@ - (void)performLayout { } else { [self.view addSubview:_toolbar]; } - + // Update nav - [self updateNavigation]; - + [self updateNavigation]; + // Content offset - _pagingScrollView.contentOffset = [self contentOffsetForPageAtIndex:_currentPageIndex]; + _pagingScrollView.contentOffset = [self contentOffsetForPageAtIndex:_currentPageIndex]; [self tilePages]; _performingLayout = NO; - + } // Release any retained subviews of the main view. - (void)viewDidUnload { - _currentPageIndex = 0; + _currentPageIndex = 0; _pagingScrollView = nil; _visiblePages = nil; _recycledPages = nil; @@ -329,10 +329,10 @@ - (BOOL)presentingViewControllerPrefersStatusBarHidden { #pragma mark - Appearance - (void)viewWillAppear:(BOOL)animated { - - // Super - [super viewWillAppear:animated]; - + + // Super + [super viewWillAppear:animated]; + // Status bar if (!_viewHasAppearedInitially) { _leaveStatusBarAlone = [self presentingViewControllerPrefersStatusBarHidden]; @@ -346,23 +346,23 @@ - (void)viewWillAppear:(BOOL)animated { _previousStatusBarStyle = [[UIApplication sharedApplication] statusBarStyle]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:animated]; } - + // Navigation bar appearance if (!_viewIsActive && [self.navigationController.viewControllers objectAtIndex:0] != self) { [self storePreviousNavBarAppearance]; } [self setNavBarAppearance:animated]; - + // Update UI - [self hideControlsAfterDelay]; - + [self hideControlsAfterDelay]; + // Initial appearance if (!_viewHasAppearedInitially) { if (_startOnGrid) { [self showGrid:NO]; } } - + // If rotation occured while we're presenting a modal // and the index changed, make sure we show the right one now if (_currentPageIndex != _pageIndexBeforeRotation) { @@ -374,7 +374,7 @@ - (void)viewWillAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; _viewIsActive = YES; - + // Autoplay if first is video if (!_viewHasAppearedInitially) { if (_autoPlayOnAppear) { @@ -384,41 +384,41 @@ - (void)viewDidAppear:(BOOL)animated { } } } - + _viewHasAppearedInitially = YES; - + } - (void)viewWillDisappear:(BOOL)animated { - + // Detect if rotation occurs while we're presenting a modal _pageIndexBeforeRotation = _currentPageIndex; - + // Check that we're being popped for good if ([self.navigationController.viewControllers objectAtIndex:0] != self && ![self.navigationController.viewControllers containsObject:self]) { - + // State _viewIsActive = NO; - + // Bar state / appearance [self restorePreviousNavBarAppearance:animated]; - + } - + // Controls [self.navigationController.navigationBar.layer removeAllAnimations]; // Stop all animations on nav bar [NSObject cancelPreviousPerformRequestsWithTarget:self]; // Cancel any pending toggles from taps [self setControlsHidden:NO animated:NO permanent:YES]; - + // Status bar if (!_leaveStatusBarAlone && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { [[UIApplication sharedApplication] setStatusBarStyle:_previousStatusBarStyle animated:animated]; } - - // Super - [super viewWillDisappear:animated]; - + + // Super + [super viewWillDisappear:animated]; + } - (void)willMoveToParentViewController:(UIViewController *)parent { @@ -437,7 +437,7 @@ - (void)setNavBarAppearance:(BOOL)animated { [self.navigationController setNavigationBarHidden:NO animated:animated]; UINavigationBar *navBar = self.navigationController.navigationBar; navBar.tintColor = [UIColor whiteColor]; - navBar.barTintColor = nil; + navBar.barTintColor = [UIColor colorWithRed: 73.0/255.0 green: 136.0/255.0 blue:242.0 alpha: 1.0];; navBar.shadowImage = nil; navBar.translucent = YES; navBar.barStyle = UIBarStyleBlackTranslucent; @@ -483,32 +483,32 @@ - (void)viewWillLayoutSubviews { } - (void)layoutVisiblePages { - - // Flag - _performingLayout = YES; - - // Toolbar - _toolbar.frame = [self frameForToolbarAtOrientation:self.interfaceOrientation]; - - // Remember index - NSUInteger indexPriorToLayout = _currentPageIndex; - - // Get paging scroll view frame to determine if anything needs changing - CGRect pagingScrollViewFrame = [self frameForPagingScrollView]; - - // Frame needs changing + + // Flag + _performingLayout = YES; + + // Toolbar + _toolbar.frame = [self frameForToolbarAtOrientation:self.interfaceOrientation]; + + // Remember index + NSUInteger indexPriorToLayout = _currentPageIndex; + + // Get paging scroll view frame to determine if anything needs changing + CGRect pagingScrollViewFrame = [self frameForPagingScrollView]; + + // Frame needs changing if (!_skipNextPagingScrollViewPositioning) { _pagingScrollView.frame = pagingScrollViewFrame; } _skipNextPagingScrollViewPositioning = NO; - - // Recalculate contentSize based on current orientation - _pagingScrollView.contentSize = [self contentSizeForPagingScrollView]; - - // Adjust frames and configuration of each visible page - for (MWZoomingScrollView *page in _visiblePages) { + + // Recalculate contentSize based on current orientation + _pagingScrollView.contentSize = [self contentSizeForPagingScrollView]; + + // Adjust frames and configuration of each visible page + for (MWZoomingScrollView *page in _visiblePages) { NSUInteger index = page.index; - page.frame = [self frameForPageAtIndex:index]; + page.frame = [self frameForPageAtIndex:index]; if (page.captionView) { page.captionView.frame = [self frameForCaptionView:page.captionView atIndex:index]; } @@ -518,7 +518,7 @@ - (void)layoutVisiblePages { if (page.playButton) { page.playButton.frame = [self frameForPlayButton:page.playButton atIndex:index]; } - + // Adjust scales if bounds has changed since last time if (!CGRectEqualToRect(_previousLayoutBounds, self.view.bounds)) { // Update zooms for new bounds @@ -526,19 +526,19 @@ - (void)layoutVisiblePages { _previousLayoutBounds = self.view.bounds; } - } - + } + // Adjust video loading indicator if it's visible [self positionVideoLoadingIndicator]; - - // Adjust contentOffset to preserve page location based on values collected prior to location - _pagingScrollView.contentOffset = [self contentOffsetForPageAtIndex:indexPriorToLayout]; - [self didStartViewingPageAtIndex:_currentPageIndex]; // initial - - // Reset - _currentPageIndex = indexPriorToLayout; - _performingLayout = NO; - + + // Adjust contentOffset to preserve page location based on values collected prior to location + _pagingScrollView.contentOffset = [self contentOffsetForPageAtIndex:indexPriorToLayout]; + [self didStartViewingPageAtIndex:_currentPageIndex]; // initial + + // Reset + _currentPageIndex = indexPriorToLayout; + _performingLayout = NO; + } #pragma mark - Rotation @@ -552,34 +552,34 @@ - (NSUInteger)supportedInterfaceOrientations { } - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { - - // Remember page index before rotation - _pageIndexBeforeRotation = _currentPageIndex; - _rotating = YES; - + + // Remember page index before rotation + _pageIndexBeforeRotation = _currentPageIndex; + _rotating = YES; + // In iOS 7 the nav bar gets shown after rotation, but might as well do this for everything! if ([self areControlsHidden]) { // Force hidden self.navigationController.navigationBarHidden = YES; } - + } - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { - - // Perform layout - _currentPageIndex = _pageIndexBeforeRotation; - - // Delay control holding - [self hideControlsAfterDelay]; - + + // Perform layout + _currentPageIndex = _pageIndexBeforeRotation; + + // Delay control holding + [self hideControlsAfterDelay]; + // Layout [self layoutVisiblePages]; - + } - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { - _rotating = NO; + _rotating = NO; // Ensure nav bar isn't re-displayed if ([self areControlsHidden]) { self.navigationController.navigationBarHidden = NO; @@ -594,10 +594,10 @@ - (NSUInteger)currentIndex { } - (void)reloadData { - + // Reset _photoCount = NSNotFound; - + // Get data NSUInteger numberOfPhotos = [self numberOfPhotos]; [self releaseAllUnderlyingPhotos:YES]; @@ -614,7 +614,7 @@ - (void)reloadData { } else { _currentPageIndex = 0; } - + // Update layout if ([self isViewLoaded]) { while (_pagingScrollView.subviews.count) { @@ -623,7 +623,10 @@ - (void)reloadData { [self performLayout]; [self.view setNeedsLayout]; } - + + if (_gridController) { + [_gridController.collectionView reloadData]; + } } - (NSUInteger)numberOfPhotos { @@ -703,15 +706,15 @@ - (void)setPhotoSelected:(BOOL)selected atIndex:(NSUInteger)index { } - (UIImage *)imageForPhoto:(id)photo { - if (photo) { - // Get image or obtain in background - if ([photo underlyingImage]) { - return [photo underlyingImage]; - } else { + if (photo) { + // Get image or obtain in background + if ([photo underlyingImage]) { + return [photo underlyingImage]; + } else { [photo loadUnderlyingImageAndNotify]; - } - } - return nil; + } + } + return nil; } - (void)loadAdjacentPhotosIfNecessary:(id)photo { @@ -751,7 +754,7 @@ - (void)handleMWPhotoLoadingDidEndNotification:(NSNotification *)notification { [page displayImage]; [self loadAdjacentPhotosIfNecessary:photo]; } else { - + // Failed to load [page displayImageFailure]; } @@ -763,51 +766,51 @@ - (void)handleMWPhotoLoadingDidEndNotification:(NSNotification *)notification { #pragma mark - Paging - (void)tilePages { - - // Calculate which pages should be visible - // Ignore padding as paging bounces encroach on that - // and lead to false page loads - CGRect visibleBounds = _pagingScrollView.bounds; - NSInteger iFirstIndex = (NSInteger)floorf((CGRectGetMinX(visibleBounds)+PADDING*2) / CGRectGetWidth(visibleBounds)); - NSInteger iLastIndex = (NSInteger)floorf((CGRectGetMaxX(visibleBounds)-PADDING*2-1) / CGRectGetWidth(visibleBounds)); + + // Calculate which pages should be visible + // Ignore padding as paging bounces encroach on that + // and lead to false page loads + CGRect visibleBounds = _pagingScrollView.bounds; + NSInteger iFirstIndex = (NSInteger)floorf((CGRectGetMinX(visibleBounds)+PADDING*2) / CGRectGetWidth(visibleBounds)); + NSInteger iLastIndex = (NSInteger)floorf((CGRectGetMaxX(visibleBounds)-PADDING*2-1) / CGRectGetWidth(visibleBounds)); if (iFirstIndex < 0) iFirstIndex = 0; if (iFirstIndex > [self numberOfPhotos] - 1) iFirstIndex = [self numberOfPhotos] - 1; if (iLastIndex < 0) iLastIndex = 0; if (iLastIndex > [self numberOfPhotos] - 1) iLastIndex = [self numberOfPhotos] - 1; - - // Recycle no longer needed pages + + // Recycle no longer needed pages NSInteger pageIndex; - for (MWZoomingScrollView *page in _visiblePages) { + for (MWZoomingScrollView *page in _visiblePages) { pageIndex = page.index; - if (pageIndex < (NSUInteger)iFirstIndex || pageIndex > (NSUInteger)iLastIndex) { - [_recycledPages addObject:page]; + if (pageIndex < (NSUInteger)iFirstIndex || pageIndex > (NSUInteger)iLastIndex) { + [_recycledPages addObject:page]; [page.captionView removeFromSuperview]; [page.selectedButton removeFromSuperview]; [page.playButton removeFromSuperview]; [page prepareForReuse]; - [page removeFromSuperview]; - MWLog(@"Removed page at index %lu", (unsigned long)pageIndex); - } - } - [_visiblePages minusSet:_recycledPages]; + [page removeFromSuperview]; + MWLog(@"Removed page at index %lu", (unsigned long)pageIndex); + } + } + [_visiblePages minusSet:_recycledPages]; while (_recycledPages.count > 2) // Only keep 2 recycled pages [_recycledPages removeObject:[_recycledPages anyObject]]; - - // Add missing pages - for (NSUInteger index = (NSUInteger)iFirstIndex; index <= (NSUInteger)iLastIndex; index++) { - if (![self isDisplayingPageForIndex:index]) { - + + // Add missing pages + for (NSUInteger index = (NSUInteger)iFirstIndex; index <= (NSUInteger)iLastIndex; index++) { + if (![self isDisplayingPageForIndex:index]) { + // Add new page - MWZoomingScrollView *page = [self dequeueRecycledPage]; - if (!page) { - page = [[MWZoomingScrollView alloc] initWithPhotoBrowser:self]; - } - [_visiblePages addObject:page]; - [self configurePage:page forIndex:index]; - - [_pagingScrollView addSubview:page]; - MWLog(@"Added page at index %lu", (unsigned long)index); - + MWZoomingScrollView *page = [self dequeueRecycledPage]; + if (!page) { + page = [[MWZoomingScrollView alloc] initWithPhotoBrowser:self]; + } + [_visiblePages addObject:page]; + [self configurePage:page forIndex:index]; + + [_pagingScrollView addSubview:page]; + MWLog(@"Added page at index %lu", (unsigned long)index); + // Add caption MWCaptionView *captionView = [self captionViewForPhotoAtIndex:index]; if (captionView) { @@ -815,7 +818,7 @@ - (void)tilePages { [_pagingScrollView addSubview:captionView]; page.captionView = captionView; } - + // Add play button if needed if (page.displayingVideo) { UIButton *playButton = [UIButton buttonWithType:UIButtonTypeCustom]; @@ -827,7 +830,7 @@ - (void)tilePages { [_pagingScrollView addSubview:playButton]; page.playButton = playButton; } - + // Add selected button if (self.displaySelectionButtons) { UIButton *selectedButton = [UIButton buttonWithType:UIButtonTypeCustom]; @@ -847,82 +850,82 @@ - (void)tilePages { page.selectedButton = selectedButton; selectedButton.selected = [self photoIsSelectedAtIndex:index]; } - - } - } - + + } + } + } - (void)updateVisiblePageStates { NSSet *copy = [_visiblePages copy]; for (MWZoomingScrollView *page in copy) { - + // Update selection page.selectedButton.selected = [self photoIsSelectedAtIndex:page.index]; - + } } - (BOOL)isDisplayingPageForIndex:(NSUInteger)index { - for (MWZoomingScrollView *page in _visiblePages) - if (page.index == index) return YES; - return NO; + for (MWZoomingScrollView *page in _visiblePages) + if (page.index == index) return YES; + return NO; } - (MWZoomingScrollView *)pageDisplayedAtIndex:(NSUInteger)index { - MWZoomingScrollView *thePage = nil; - for (MWZoomingScrollView *page in _visiblePages) { - if (page.index == index) { - thePage = page; break; - } - } - return thePage; + MWZoomingScrollView *thePage = nil; + for (MWZoomingScrollView *page in _visiblePages) { + if (page.index == index) { + thePage = page; break; + } + } + return thePage; } - (MWZoomingScrollView *)pageDisplayingPhoto:(id)photo { - MWZoomingScrollView *thePage = nil; - for (MWZoomingScrollView *page in _visiblePages) { - if (page.photo == photo) { - thePage = page; break; - } - } - return thePage; + MWZoomingScrollView *thePage = nil; + for (MWZoomingScrollView *page in _visiblePages) { + if (page.photo == photo) { + thePage = page; break; + } + } + return thePage; } - (void)configurePage:(MWZoomingScrollView *)page forIndex:(NSUInteger)index { - page.frame = [self frameForPageAtIndex:index]; + page.frame = [self frameForPageAtIndex:index]; page.index = index; page.photo = [self photoAtIndex:index]; } - (MWZoomingScrollView *)dequeueRecycledPage { - MWZoomingScrollView *page = [_recycledPages anyObject]; - if (page) { - [_recycledPages removeObject:page]; - } - return page; + MWZoomingScrollView *page = [_recycledPages anyObject]; + if (page) { + [_recycledPages removeObject:page]; + } + return page; } // Handle page changes - (void)didStartViewingPageAtIndex:(NSUInteger)index { - + // Handle 0 photos if (![self numberOfPhotos]) { // Show controls [self setControlsHidden:NO animated:YES permanent:YES]; return; } - + // Handle video on page change if (!_rotating || index != _currentVideoIndex) { [self clearCurrentVideo]; } - + // Release images further away than +/-1 NSUInteger i; if (index > 0) { // Release anything < index - 1 - for (i = 0; i < index-1; i++) { + for (i = 0; i < index-1; i++) { id photo = [_photos objectAtIndex:i]; if (photo != [NSNull null]) { [photo unloadUnderlyingImage]; @@ -942,7 +945,7 @@ - (void)didStartViewingPageAtIndex:(NSUInteger)index { } } } - + // Load adjacent images if needed and the photo is already // loaded. Also called after photo has been loaded in background id currentPhoto = [self photoAtIndex:index]; @@ -950,17 +953,17 @@ - (void)didStartViewingPageAtIndex:(NSUInteger)index { // photo loaded so load ajacent now [self loadAdjacentPhotosIfNecessary:currentPhoto]; } - + // Notify delegate if (index != _previousPageIndex) { if ([_delegate respondsToSelector:@selector(photoBrowser:didDisplayPhotoAtIndex:)]) [_delegate photoBrowser:self didDisplayPhotoAtIndex:index]; _previousPageIndex = index; } - + // Update nav [self updateNavigation]; - + } #pragma mark - Frame Calculations @@ -991,16 +994,16 @@ - (CGSize)contentSizeForPagingScrollView { } - (CGPoint)contentOffsetForPageAtIndex:(NSUInteger)index { - CGFloat pageWidth = _pagingScrollView.bounds.size.width; - CGFloat newOffset = index * pageWidth; - return CGPointMake(newOffset, 0); + CGFloat pageWidth = _pagingScrollView.bounds.size.width; + CGFloat newOffset = index * pageWidth; + return CGPointMake(newOffset, 0); } - (CGRect)frameForToolbarAtOrientation:(UIInterfaceOrientation)orientation { CGFloat height = 44; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && UIInterfaceOrientationIsLandscape(orientation)) height = 32; - return CGRectIntegral(CGRectMake(0, self.view.bounds.size.height - height, self.view.bounds.size.width, height)); + return CGRectIntegral(CGRectMake(0, self.view.bounds.size.height - height, self.view.bounds.size.width, height)); } - (CGRect)frameForCaptionView:(MWCaptionView *)captionView atIndex:(NSUInteger)index { @@ -1039,41 +1042,43 @@ - (CGRect)frameForPlayButton:(UIButton *)playButton atIndex:(NSUInteger)index { #pragma mark - UIScrollView Delegate - (void)scrollViewDidScroll:(UIScrollView *)scrollView { - + + scrollView.scrollEnabled = false; + // Checks - if (!_viewIsActive || _performingLayout || _rotating) return; - - // Tile pages - [self tilePages]; - - // Calculate current page - CGRect visibleBounds = _pagingScrollView.bounds; - NSInteger index = (NSInteger)(floorf(CGRectGetMidX(visibleBounds) / CGRectGetWidth(visibleBounds))); + if (!_viewIsActive || _performingLayout || _rotating) return; + + // Tile pages + [self tilePages]; + + // Calculate current page + CGRect visibleBounds = _pagingScrollView.bounds; + NSInteger index = (NSInteger)(floorf(CGRectGetMidX(visibleBounds) / CGRectGetWidth(visibleBounds))); if (index < 0) index = 0; - if (index > [self numberOfPhotos] - 1) index = [self numberOfPhotos] - 1; - NSUInteger previousCurrentPage = _currentPageIndex; - _currentPageIndex = index; - if (_currentPageIndex != previousCurrentPage) { + if (index > [self numberOfPhotos] - 1) index = [self numberOfPhotos] - 1; + NSUInteger previousCurrentPage = _currentPageIndex; + _currentPageIndex = index; + if (_currentPageIndex != previousCurrentPage) { [self didStartViewingPageAtIndex:index]; } - + } - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { - // Hide controls when dragging begins - [self setControlsHidden:YES animated:YES permanent:NO]; + // Hide controls when dragging begins + [self setControlsHidden:YES animated:YES permanent:NO]; } - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { - // Update nav when page changes - [self updateNavigation]; + // Update nav when page changes + [self updateNavigation]; } #pragma mark - Navigation - (void)updateNavigation { - - // Title + + // Title NSUInteger numberOfPhotos = [self numberOfPhotos]; if (_gridController) { if (_gridController.selectionMode) { @@ -1093,14 +1098,14 @@ - (void)updateNavigation { } else { self.title = [NSString stringWithFormat:@"%lu %@ %lu", (unsigned long)(_currentPageIndex+1), NSLocalizedString(@"of", @"Used in the context: 'Showing 1 of 3 items'"), (unsigned long)numberOfPhotos]; } - } else { - self.title = nil; - } - - // Buttons - _previousButton.enabled = (_currentPageIndex > 0); - _nextButton.enabled = (_currentPageIndex < numberOfPhotos - 1); - + } else { + self.title = nil; + } + + // Buttons + _previousButton.enabled = (_currentPageIndex > 0); + _nextButton.enabled = (_currentPageIndex < numberOfPhotos - 1); + // Disable action button if there is no image or it's a video MWPhoto *photo = [self photoAtIndex:_currentPageIndex]; if ([photo underlyingImage] == nil || ([photo respondsToSelector:@selector(isVideo)] && photo.isVideo)) { @@ -1110,21 +1115,21 @@ - (void)updateNavigation { _actionButton.enabled = YES; _actionButton.tintColor = nil; } - + } - (void)jumpToPageAtIndex:(NSUInteger)index animated:(BOOL)animated { - - // Change page - if (index < [self numberOfPhotos]) { - CGRect pageFrame = [self frameForPageAtIndex:index]; + + // Change page + if (index < [self numberOfPhotos]) { + CGRect pageFrame = [self frameForPageAtIndex:index]; [_pagingScrollView setContentOffset:CGPointMake(pageFrame.origin.x - PADDING, 0) animated:animated]; - [self updateNavigation]; - } - - // Update timer to give more time - [self hideControlsAfterDelay]; - + [self updateNavigation]; + } + + // Update timer to give more time + [self hideControlsAfterDelay]; + } - (void)gotoPreviousPage { @@ -1180,12 +1185,12 @@ - (void)playButtonTapped:(id)sender { - (void)playVideoAtIndex:(NSUInteger)index { id photo = [self photoAtIndex:index]; if ([photo respondsToSelector:@selector(getVideoURL:)]) { - + // Valid for playing _currentVideoIndex = index; [self clearCurrentVideo]; [self setVideoLoadingIndicatorVisible:YES atPageIndex:index]; - + // Get video and play [photo getVideoURL:^(NSURL *url) { if (url) { @@ -1196,7 +1201,7 @@ - (void)playVideoAtIndex:(NSUInteger)index { [self setVideoLoadingIndicatorVisible:NO atPageIndex:index]; } }]; - + } } @@ -1208,7 +1213,7 @@ - (void)_playVideo:(NSURL *)videoURL atPhotoIndex:(NSUInteger)index { _currentVideoPlayerViewController.moviePlayer.shouldAutoplay = YES; _currentVideoPlayerViewController.moviePlayer.scalingMode = MPMovieScalingModeAspectFit; _currentVideoPlayerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; - + // Remove the movie player view controller from the "playback did finish" notification observers // Observe ourselves so we can get it to use the crossfade transition [[NSNotificationCenter defaultCenter] removeObserver:_currentVideoPlayerViewController @@ -1225,15 +1230,15 @@ - (void)_playVideo:(NSURL *)videoURL atPhotoIndex:(NSUInteger)index { } - (void)videoFinishedCallback:(NSNotification*)notification { - + // Remove observer [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:_currentVideoPlayerViewController.moviePlayer]; - + // Clear up [self clearCurrentVideo]; - + // Dismiss BOOL error = [[[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue] == MPMovieFinishReasonPlaybackError; if (error) { @@ -1244,7 +1249,7 @@ - (void)videoFinishedCallback:(NSNotification*)notification { } else { [self dismissViewControllerAnimated:YES completion:nil]; } - + } - (void)clearCurrentVideo { @@ -1284,7 +1289,7 @@ - (void)showGridAnimated { - (void)showGrid:(BOOL)animated { if (_gridController) return; - + // Init grid controller _gridController = [[MWGridViewController alloc] init]; _gridController.initialContentOffset = _currentGridContentOffset; @@ -1295,15 +1300,15 @@ - (void)showGrid:(BOOL)animated { // Stop specific layout being triggered _skipNextPagingScrollViewPositioning = YES; - + // Add as a child view controller [self addChildViewController:_gridController]; [self.view addSubview:_gridController.view]; - + // Perform any adjustments [_gridController.view layoutIfNeeded]; [_gridController adjustOffsetsAsRequired]; - + // Hide action button on nav bar if it exists if (self.navigationItem.rightBarButtonItem == _actionButton) { _gridPreviousRightNavItem = _actionButton; @@ -1311,11 +1316,11 @@ - (void)showGrid:(BOOL)animated { } else { _gridPreviousRightNavItem = nil; } - + // Update [self updateNavigation]; [self setControlsHidden:NO animated:YES permanent:YES]; - + // Animate grid in and photo scroller out [_gridController willMoveToParentViewController:self]; [UIView animateWithDuration:animated ? 0.3 : 0 animations:^(void) { @@ -1326,34 +1331,34 @@ - (void)showGrid:(BOOL)animated { } completion:^(BOOL finished) { [_gridController didMoveToParentViewController:self]; }]; - + } - (void)hideGrid { - + if (!_gridController) return; - + // Remember previous content offset _currentGridContentOffset = _gridController.collectionView.contentOffset; - + // Restore action button if it was removed if (_gridPreviousRightNavItem == _actionButton && _actionButton) { [self.navigationItem setRightBarButtonItem:_gridPreviousRightNavItem animated:YES]; } - + // Position prior to hide animation CGRect newPagingFrame = [self frameForPagingScrollView]; newPagingFrame = CGRectOffset(newPagingFrame, 0, (self.startOnGrid ? 1 : -1) * newPagingFrame.size.height); _pagingScrollView.frame = newPagingFrame; - + // Remember and remove controller now so things can detect a nil grid controller MWGridViewController *tmpGridController = _gridController; _gridController = nil; - + // Update [self updateNavigation]; [self updateVisiblePageStates]; - + // Animate, hide grid and show paging scroll view [UIView animateWithDuration:0.3 animations:^{ tmpGridController.view.frame = CGRectOffset(self.view.bounds, 0, (self.startOnGrid ? -1 : 1) * self.view.bounds.size.height); @@ -1372,46 +1377,46 @@ - (void)hideGrid { // If permanent then we don't set timers to hide again // Fades all controls on iOS 5 & 6, and iOS 7 controls slide and fade - (void)setControlsHidden:(BOOL)hidden animated:(BOOL)animated permanent:(BOOL)permanent { - + // Force visible if (![self numberOfPhotos] || _gridController || _alwaysShowControls) hidden = NO; - + // Cancel any timers [self cancelControlHiding]; - + // Animations & positions CGFloat animatonOffset = 20; CGFloat animationDuration = (animated ? 0.35 : 0); - + // Status bar if (!_leaveStatusBarAlone) { // Hide status bar if (!_isVCBasedStatusBarAppearance) { - + // Non-view controller based [[UIApplication sharedApplication] setStatusBarHidden:hidden withAnimation:animated ? UIStatusBarAnimationSlide : UIStatusBarAnimationNone]; - + } else { - + // View controller based so animate away _statusBarShouldBeHidden = hidden; [UIView animateWithDuration:animationDuration animations:^(void) { [self setNeedsStatusBarAppearanceUpdate]; } completion:^(BOOL finished) {}]; - + } } - + // Toolbar, nav bar and captions // Pre-appear animation positions for sliding if ([self areControlsHidden] && !hidden && animated) { - + // Toolbar _toolbar.frame = CGRectOffset([self frameForToolbarAtOrientation:self.interfaceOrientation], 0, animatonOffset); - + // Captions for (MWZoomingScrollView *page in _visiblePages) { if (page.captionView) { @@ -1422,15 +1427,15 @@ - (void)setControlsHidden:(BOOL)hidden animated:(BOOL)animated permanent:(BOOL)p v.frame = CGRectOffset(captionFrame, 0, animatonOffset); } } - + } [UIView animateWithDuration:animationDuration animations:^(void) { - + CGFloat alpha = hidden ? 0 : 1; // Nav bar slides up on it's own on iOS 7+ [self.navigationController.navigationBar setAlpha:alpha]; - + // Toolbar _toolbar.frame = [self frameForToolbarAtOrientation:self.interfaceOrientation]; if (hidden) _toolbar.frame = CGRectOffset(_toolbar.frame, 0, animatonOffset); @@ -1448,7 +1453,7 @@ - (void)setControlsHidden:(BOOL)hidden animated:(BOOL)animated permanent:(BOOL)p v.alpha = alpha; } } - + // Selected buttons for (MWZoomingScrollView *page in _visiblePages) { if (page.selectedButton) { @@ -1460,12 +1465,12 @@ - (void)setControlsHidden:(BOOL)hidden animated:(BOOL)animated permanent:(BOOL)p } } completion:^(BOOL finished) {}]; - - // Control hiding timer - // Will cancel existing timer but only begin hiding if - // they are visible - if (!permanent) [self hideControlsAfterDelay]; - + + // Control hiding timer + // Will cancel existing timer but only begin hiding if + // they are visible + if (!permanent) [self hideControlsAfterDelay]; + } - (BOOL)prefersStatusBarHidden { @@ -1485,19 +1490,19 @@ - (UIStatusBarAnimation)preferredStatusBarUpdateAnimation { } - (void)cancelControlHiding { - // If a timer exists then cancel and release - if (_controlVisibilityTimer) { - [_controlVisibilityTimer invalidate]; - _controlVisibilityTimer = nil; - } + // If a timer exists then cancel and release + if (_controlVisibilityTimer) { + [_controlVisibilityTimer invalidate]; + _controlVisibilityTimer = nil; + } } // Enable/disable control visiblity timer - (void)hideControlsAfterDelay { - if (![self areControlsHidden]) { + if (![self areControlsHidden]) { [self cancelControlHiding]; - _controlVisibilityTimer = [NSTimer scheduledTimerWithTimeInterval:self.delayToHideElements target:self selector:@selector(hideControls) userInfo:nil repeats:NO]; - } + _controlVisibilityTimer = [NSTimer scheduledTimerWithTimeInterval:self.delayToHideElements target:self selector:@selector(hideControls) userInfo:nil repeats:NO]; + } } - (BOOL)areControlsHidden { return (_toolbar.alpha == 0); } @@ -1517,7 +1522,7 @@ - (void)setCurrentPhotoIndex:(NSUInteger)index { index = [self numberOfPhotos]-1; } _currentPageIndex = index; - if ([self isViewLoaded]) { + if ([self isViewLoaded]) { [self jumpToPageAtIndex:index animated:NO]; if (!_viewIsActive) [self tilePages]; // Force tiling if view is not visible @@ -1556,22 +1561,22 @@ - (void)actionButtonPressed:(id)sender { // Only react when image has loaded id photo = [self photoAtIndex:_currentPageIndex]; if ([self numberOfPhotos] > 0 && [photo underlyingImage]) { - + // If they have defined a delegate method then just message them if ([self.delegate respondsToSelector:@selector(photoBrowser:actionButtonPressedForPhotoAtIndex:)]) { - + // Let delegate handle things [self.delegate photoBrowser:self actionButtonPressedForPhotoAtIndex:_currentPageIndex]; - + } else { - + // Show activity view controller NSMutableArray *items = [NSMutableArray arrayWithObject:[photo underlyingImage]]; if (photo.caption) { [items addObject:photo.caption]; } self.activityViewController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil]; - + // Show loading spinner after a couple of seconds double delayInSeconds = 2.0; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); @@ -1595,12 +1600,12 @@ - (void)actionButtonPressed:(id)sender { [self presentViewController:self.activityViewController animated:YES completion:nil]; } - + // Keep controls hidden [self setControlsHidden:NO animated:YES permanent:YES]; } - + } #pragma mark - Action Progress From da46a6c14f9f83a4477c672b4448c6cf924892d6 Mon Sep 17 00:00:00 2001 From: mpatel Date: Wed, 16 Dec 2015 14:35:36 +0530 Subject: [PATCH 3/6] for test --- Pod/Classes/MWPhotoBrowser.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pod/Classes/MWPhotoBrowser.m b/Pod/Classes/MWPhotoBrowser.m index 44d681831..d11f3822d 100644 --- a/Pod/Classes/MWPhotoBrowser.m +++ b/Pod/Classes/MWPhotoBrowser.m @@ -82,7 +82,7 @@ - (void)_initialisation { _didSavePreviousStateOfNavBar = NO; self.automaticallyAdjustsScrollViewInsets = NO; - // Listen for MWPhoto notifications + // Listen for MWPhoto notifications [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleMWPhotoLoadingDidEndNotification:) name:MWPHOTO_LOADING_DID_END_NOTIFICATION From 0c3ebdc4439eb6ae6c3055c2687555d70df0c727 Mon Sep 17 00:00:00 2001 From: mpatel Date: Wed, 16 Dec 2015 14:43:44 +0530 Subject: [PATCH 4/6] Changed the Color of * Grid Cell * Gird Background Color * Zoom Image Color * Changed the Image white to black Color --- Pod/Assets/ImageError.png | Bin 1187 -> 1135 bytes Pod/Assets/ImageError@2x.png | Bin 1533 -> 1441 bytes Pod/Assets/ImageError@3x.png | Bin 1848 -> 1707 bytes Pod/Classes/MWGridCell.m | 2 +- Pod/Classes/MWGridViewController.m | 2 +- Pod/Classes/MWZoomingScrollView.m | 6 +++--- 6 files changed, 5 insertions(+), 5 deletions(-) mode change 100644 => 100755 Pod/Assets/ImageError.png mode change 100644 => 100755 Pod/Assets/ImageError@2x.png mode change 100644 => 100755 Pod/Assets/ImageError@3x.png diff --git a/Pod/Assets/ImageError.png b/Pod/Assets/ImageError.png old mode 100644 new mode 100755 index eca298bc928798ab50088ce3651c5891e7c4f957..e0a77f6c01d1303072dc15e29e2a3bbaf53d2f3b GIT binary patch delta 431 zcmZ3?`JQ8fC!@+nFLlPrcNmo>XEA0^-o>Opxtd8@!NS?V(9PM&#L~&t($LV=)WX!n z(ZbQp+}P04)y2roaIzhf3`~(JPDL-63}A|ka4NE3hMQ!JQ&9=CQ@um_I(G&JhKHUm zjv*Dd-rR`hYETeh4agSOTlBa7x>}a?vJ2Cn*hs18J!}wAsoJ#VqUKVO3CVm93>)^d zw;6f9nv{Gp^|b1}yX#*?DL>mZ%`X3Teo0ip(?<^`$QJy*dVLw=G4A6^y%yW}vr{B#vq$h zc@9h~fBD5W@-E2|+RM0R;w;H?+y0-e`Cz_YqH2N3mTw=MT~)IWT|{Om)9l=}f@i-wXpOgsz;)15XXt-Iy`^euy@tDnm{r-UW|((s)2 delta 474 zcmaFQv6yp$Cu7D&FLlPrvlvq*XEAE>6!`jD`4?rTXXYj5OfFy&Q7|z!b98exa&a;+ zGBC3+G_)`>a&&YtadEV8adR=xXd}WNhJV>SpF* z>SQ`u2cgIqr=nks#*>#a>1&#pDc*PNkns_jZm?MRvf5sbxqcJ!z8D_!i>y-4 zV6mUJ@KdeNtI4~>EmGuzKkl4f)5QMjv6kY>)o&a#j?L@Vuix_gjKKuYd!H`y98f8D zo#6UOP)$al*Ol2V@q+A@Tl)&Re3zfk+vk2Zyt(qG;=!X{;u}t+KQYO8mlDF7k(53~ zFC$aNs`Te?{b_tcFHMx^u2||lw`8-z-8@h8HJ5bvf4QJyTXu^7-6wzfWW$6>wXEA0^-o>Opxtd8@!NS?V(9PM&z|zUp($LV=)WX!n z(ZbQp+}P04)y2roaIzhf3`~(BPDL-644{e}U2!V1V1}9G=!R2K3A0nZ-S>vi3=B-d zo-U3d6}R5paqMe0;9YTCcw;P+qEFjsNagH-0SrWI}B zEF66+y25!lx>oe5GqE_E92915QjmM})K6s%gROGikhyBNwzEl^v;C8xBYo^6qo zoYn%CKv90l4J?7O{IUk@7g^S`9}sad-V?`QuXs=AV-=H))#WDDxcr9nj#m}7OmW*z zf0KQ1R_Ufk`h!Ep0d{P9GR&7h_PsmA{r*s9Me(C=3mJn8&j?(6e#lZot>c7$vX{XX z!NB?KUIHP4g7ZDHOX7G1-_GrL_H_9s`}!r@i^R$UKh_1_3Po&;k4*gFBjA2G*j+}@Uv%Q?vXGdq%Il;*SHG;jJLAUw zlSMpFj8D1#zcsb{!l|b2enI4zWLYC$&&0#fm;0}4yI)W{0}yz+`njxgN@xNA)c_*z delta 823 zcmZ3;{g-=!Cu7D&FLlPrvlvq*XEAE>6!`jD`4?rTXXYj5OfFy&Q7|z!b98exa&a;+ zGBC3+G_)`>a&&YtadEV8adR=xXd}WNhJV>SpF* z>SQ`u2d>D%4X2`CjK-6fGU;oYnBcckNujtTC^gM0WpW{tFkuH8Fgw++Z81B> zz`&&K>EaktaqG>UyID+z0;~z5chqB|qJH_kb^Xm2l%ad&d2ws5lXArC_%dVT^iAmr zdLh^5{`7J2JhA8fZ^`5e9S;WwCZP!pJRpK4PPsyV>wQB z-}i6iy_pu%Jtz0oa{s@kme-%($*8~kzgJ3t|Kqof=PLW>X#No_D*sR+`RVS*lDy!* zr<T zr&UBXOzK!xF{?qS<5|V6230}D4>}Cq3Wpv3Gm01ZK3je*vtN1LZM&8~kDe|1FBmB2To(61pgi4m&UWMVdlx-C>M-lj z^<{9;xTF1A%?F*=tVL}$?pofW9`ygphpz92u6q{!eX@r8{``pTt+zD|iuBJJ zebp?>JF~25qIY?wO5U$C#mPnAj~$s@8}@RF{Ceg0cg}U}p5U*zeV)1a#}9@~MjRfX i*mVR)anI_H$_E&N(gYMkzj_^H00K`}KbLh*2~7aOm{CIj diff --git a/Pod/Assets/ImageError@3x.png b/Pod/Assets/ImageError@3x.png old mode 100644 new mode 100755 index aa2ba3ac428807e0ce3cbe5ecee26f772a0e6c8e..84ff3fab6fc53285476f4b8b059d68328dfe1a3f GIT binary patch delta 1071 zcmdnNx0-i?C!@+luRc{{-DCqpLj^N4Jwp>yGc!XS1tSAPBYguPGSf9Qu`)HYGBTg| zw`B4iMy1JFjM*7U zY{w)6Q{;$K(F-Pn7^q3+xD+WV6qf|0rdg%rCzs}?=9PH5*eX@z7U-p9rdUDsTHw+< zxr^DUUTXyt2Ll7Mtfz}(NX4x;ckTV&7zi9MoYd6S#9c6_*X6inAeYuR2bl+fdvY^A zy;-inn%Q`^>X_X5n)*rFVn@HR=lcBXX-|#J>$uWzBAY4i!C3%O`0R`zpSDDyua;#G`IKfu1wNY7l_JOsGGJ=)Y zD{L9uo$lHC)$1P+oUmSMzIwv>6XE@*r8l@gS@f}j9i61-2m`rE;k!?^R*M`h;i zF6+wfyf~mcVYM9pgI$y3{z@}HsG5BLNeM%NY)cxqRl`@qS?jLVGhTDe{P*ANK$V4> z-ZF+Y%{kACG!A?^v20x_vrczS`rACw1Dj6NuesZGh3#9&%Xi9KmtX0#uX*;beZK7V z`~M3})ZckY#x=>XU042KdLpl|xb4#C7Y00G$ES&h_nF@CU$^}v!Smf#>XQV=_Z@mG`W8;u zDRy>i#yd5}JEH3}QyNMOD;71UZ>msRoqp%p35M&=4|ZnU%Xx6NZC>GQnf~qEmAfZ= zZ?3kp%m4AY&EC|i%5B*xzRZO?|hb#C`3lc@tNfd2fw;<@&wH=V|RxT5B$bowx`~}x$r;MT|arqvcjsFCr@${ z$GRt4Roy)A`sPHQeo|=@@yEU*>io$E?^y0B*q@)YV<)fI`uPINk~5jWi4~fF*&wMH goPZy!_^Ez?!S3Gu+k9K90~mn7)78&qol`;+0I>$lGynhq delta 1207 zcmZ3@yMu3nCu7}2uRc{X-DCqp69sciJwsD7b4zm_1tTC|-@roO$UxV?(#q7>%D`yi z-;&9*7*i%^F>3M@`1)G;7iFer<|XD#E?^Q-FflfBbaORwaWXJ6Ftac;v@kMqbaXLs zakOx8b1`$VoSeZVqhMy~;%MmV=4$Bd0lb15-*QchX8d@4AChA%mTAJyaB%2!RCZ?L0>L#TorzRyC8yXv#B`GNsmjtDz zS*7GBm*%GCm3X??DkY}mC#8Z!GE=MyGV)9Ei!<^ItSl_e%u~(NQgzKtjm&fn4b3fd zElpF5buAOkj10|<4NOxEES2=_6m0a1QqrtkQi~_sGMm;%yX>%GU|}Yq*|YU_HV8VVU{~e%%Sj znf_O>i$5vcvHV1N^8b@rDSp>>n%_LWuIIK9-;8ti`N``aIM)jA{{M$B{8N*-YqzV| zi9Y*}QMPK0Z@!dWD_YE)(w;r_TJ%%}>-y*pzm4L&n-(wcS;;5uQ1*$#@@ZyJT8jB^ z=3sg8G?%iiKaG!97O16^TUQs${z!Ky+nH;f?$&O!>9+09oxx=y6JzCf=uDivwB^k| zliZa{tXZE3xG(ii3w3kjE9To*ax2H>Nq{Gx+^0p#itVQpK2G`}$7q>SHEH=Nw(}P=ei;ZR{g^PZy30!|PU2cMEP?K%AxL&8uzMa=l3Rrl}XMzp8n1s=h|=aj{s8>4ScyQB>+{;l$B%G!SOUtCQ++xFG=``@=%^UlzC zr^>DS(vNwXOt{?5Ne}JPowvE{*u86k*Hz;qLJ#joyC*szpCy(>fin*bf@Oybv^GN z@WpM&d!74!<6u(`mr^&Y$IZw4UnboFyt I=akR{00D&X_5c6? diff --git a/Pod/Classes/MWGridCell.m b/Pod/Classes/MWGridCell.m index ba29c4540..f6cc7ce8e 100644 --- a/Pod/Classes/MWGridCell.m +++ b/Pod/Classes/MWGridCell.m @@ -32,7 +32,7 @@ - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { // Grey background - self.backgroundColor = [UIColor colorWithWhite:0.12 alpha:1]; + self.backgroundColor = [UIColor whiteColor]; // Image _imageView = [UIImageView new]; diff --git a/Pod/Classes/MWGridViewController.m b/Pod/Classes/MWGridViewController.m index a41d0b8d5..80ba043cc 100644 --- a/Pod/Classes/MWGridViewController.m +++ b/Pod/Classes/MWGridViewController.m @@ -60,7 +60,7 @@ - (void)viewDidLoad { [super viewDidLoad]; [self.collectionView registerClass:[MWGridCell class] forCellWithReuseIdentifier:@"GridCell"]; self.collectionView.alwaysBounceVertical = YES; - self.collectionView.backgroundColor = [UIColor blackColor]; + self.collectionView.backgroundColor = [UIColor whiteColor]; } - (void)viewWillDisappear:(BOOL)animated { diff --git a/Pod/Classes/MWZoomingScrollView.m b/Pod/Classes/MWZoomingScrollView.m index 86aa73547..ba07c36a5 100644 --- a/Pod/Classes/MWZoomingScrollView.m +++ b/Pod/Classes/MWZoomingScrollView.m @@ -40,14 +40,14 @@ - (id)initWithPhotoBrowser:(MWPhotoBrowser *)browser { _tapView = [[MWTapDetectingView alloc] initWithFrame:self.bounds]; _tapView.tapDelegate = self; _tapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - _tapView.backgroundColor = [UIColor blackColor]; + _tapView.backgroundColor = [UIColor whiteColor]; [self addSubview:_tapView]; // Image view _photoImageView = [[MWTapDetectingImageView alloc] initWithFrame:CGRectZero]; _photoImageView.tapDelegate = self; _photoImageView.contentMode = UIViewContentModeCenter; - _photoImageView.backgroundColor = [UIColor blackColor]; + _photoImageView.backgroundColor = [UIColor whiteColor]; [self addSubview:_photoImageView]; // Loading indicator @@ -66,7 +66,7 @@ - (id)initWithPhotoBrowser:(MWPhotoBrowser *)browser { object:nil]; // Setup - self.backgroundColor = [UIColor blackColor]; + self.backgroundColor = [UIColor whiteColor]; self.delegate = self; self.showsHorizontalScrollIndicator = NO; self.showsVerticalScrollIndicator = NO; From f5898e27b7e48860f88511bc65b20a5952408c89 Mon Sep 17 00:00:00 2001 From: mpatel Date: Wed, 16 Dec 2015 14:47:41 +0530 Subject: [PATCH 5/6] * Changed the Color of Circle progress view while loading image in MWPhotoBrowser --- .../DACircularProgress/DACircularProgressView.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Example/Pods/DACircularProgress/DACircularProgress/DACircularProgressView.m b/Example/Pods/DACircularProgress/DACircularProgress/DACircularProgressView.m index ea39dcdd8..d0c2ad553 100644 --- a/Example/Pods/DACircularProgress/DACircularProgress/DACircularProgressView.m +++ b/Example/Pods/DACircularProgress/DACircularProgress/DACircularProgressView.m @@ -133,8 +133,8 @@ + (void) initialize { if (self == [DACircularProgressView class]) { DACircularProgressView *circularProgressViewAppearance = [DACircularProgressView appearance]; - [circularProgressViewAppearance setTrackTintColor:[[UIColor whiteColor] colorWithAlphaComponent:0.3f]]; - [circularProgressViewAppearance setProgressTintColor:[UIColor whiteColor]]; + [circularProgressViewAppearance setTrackTintColor:[[UIColor blackColor] colorWithAlphaComponent:0.3f]]; + [circularProgressViewAppearance setProgressTintColor:[UIColor blackColor]]; [circularProgressViewAppearance setInnerTintColor:nil]; [circularProgressViewAppearance setBackgroundColor:[UIColor clearColor]]; [circularProgressViewAppearance setThicknessRatio:0.3f]; From 0a9a9afd13ceec16c988b8ecede220175e207b83 Mon Sep 17 00:00:00 2001 From: mpatel Date: Thu, 17 Dec 2015 15:54:24 +0530 Subject: [PATCH 6/6] Force Video to Landscape when auto layout not supported --- Pod/Classes/MWPhotoBrowser.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Pod/Classes/MWPhotoBrowser.m b/Pod/Classes/MWPhotoBrowser.m index d11f3822d..b885dec26 100644 --- a/Pod/Classes/MWPhotoBrowser.m +++ b/Pod/Classes/MWPhotoBrowser.m @@ -1214,6 +1214,12 @@ - (void)_playVideo:(NSURL *)videoURL atPhotoIndex:(NSUInteger)index { _currentVideoPlayerViewController.moviePlayer.scalingMode = MPMovieScalingModeAspectFit; _currentVideoPlayerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; + // When Autolayout is not supported then force video to Landscape + CGAffineTransform landscapeTransform; + landscapeTransform = CGAffineTransformMakeRotation(90*M_PI/180.0f); + landscapeTransform = CGAffineTransformTranslate(landscapeTransform, 80, 80); + [_currentVideoPlayerViewController.moviePlayer.view setTransform: landscapeTransform]; + // Remove the movie player view controller from the "playback did finish" notification observers // Observe ourselves so we can get it to use the crossfade transition [[NSNotificationCenter defaultCenter] removeObserver:_currentVideoPlayerViewController