Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #46 from ZZBHuang/refactor
Browse files Browse the repository at this point in the history
Refactor for redundancy
  • Loading branch information
stewwu authored Jan 8, 2018
2 parents fa1a6db + e5658c1 commit 76072fd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 28 deletions.
2 changes: 1 addition & 1 deletion YangMingShan.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = 'YangMingShan'
s.author = { "Team" => "yang-ming-shan@oath.com" }
s.version = '2.0.0'
s.version = '2.0.1'
s.summary = 'The collection of useful UI components that inspired by Yahoo apps.'
s.homepage = 'https://github.com/yahoo/YangMingShan'
s.license = "Yahoo! Inc. BSD license"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ - (void)viewDidLayoutSubviews
}
}

- (UIStatusBarStyle)preferredStatusBarStyle
{
return [YMSPhotoPickerTheme sharedInstance].statusBarStyle;
}

#pragma mark - IBActions

- (IBAction)dismiss:(id)sender
Expand Down
20 changes: 4 additions & 16 deletions YangMingShan/YMSPhotoPicker/Private/YMSSinglePhotoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ - (void)viewDidLoad {
self.photoImageView.image = result;
}];

UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(switchPresentationStyle:)];
[self.imageContainerView addGestureRecognizer:tapGestureRecognizer];

self.navigationController.hidesBarsOnTap = YES;
[self.navigationController.barHideOnTapGestureRecognizer addTarget:self action:@selector(switchPresentationStyle:)];
self.presentationStyle = PresentationStyleDefault;
}

Expand All @@ -80,15 +80,6 @@ - (UIStatusBarStyle)preferredStatusBarStyle
return [YMSPhotoPickerTheme sharedInstance].statusBarStyle;
}

- (BOOL)prefersStatusBarHidden
{
if (self.presentationStyle == PresentationStyleDefault
&& self.traitCollection.verticalSizeClass == UIUserInterfaceSizeClassRegular) {
return NO;
}
return YES;
}

#pragma mark - IBActions

- (IBAction)dismiss:(id)sender
Expand All @@ -112,21 +103,17 @@ - (IBAction)switchPresentationStyle:(id)sender
if (self.presentationStyle == PresentationStyleDefault) {
[UIView animateWithDuration:0.15 animations:^{
self.view.backgroundColor = [UIColor blackColor];
self.navigationController.navigationBar.alpha = 0.0;
self.navigationBarBackgroundView.alpha = 0.0;
} completion:^(BOOL finished) {
self.presentationStyle = PresentationStyleDark;
[self setNeedsStatusBarAppearanceUpdate];
}];
}
else if (self.presentationStyle == PresentationStyleDark) {
[UIView animateWithDuration:0.15 animations:^{
self.view.backgroundColor = [UIColor whiteColor];
self.navigationController.navigationBar.alpha = 1.0;
self.navigationBarBackgroundView.alpha = 1.0;
} completion:^(BOOL finished) {
self.presentationStyle = PresentationStyleDefault;
[self setNeedsStatusBarAppearanceUpdate];
}];
}
}
Expand All @@ -140,6 +127,7 @@ - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(nullable UIView *)view atScale:(CGFloat)scale
{
if (scale <= 1.0 && self.presentationStyle == PresentationStyleDark) {
[self.navigationController setNavigationBarHidden:NO animated:YES];
[self switchPresentationStyle:nil];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id <UIV
[self.photoCollectionView.collectionViewLayout invalidateLayout];
}

- (UIStatusBarStyle)preferredStatusBarStyle
{
return [YMSPhotoPickerTheme sharedInstance].statusBarStyle;
}


- (void)viewSafeAreaInsetsDidChange {
[super viewSafeAreaInsetsDidChange];
UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.photoCollectionView.collectionViewLayout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down

0 comments on commit 76072fd

Please sign in to comment.