Skip to content

Commit

Permalink
fix #103
Browse files Browse the repository at this point in the history
  • Loading branch information
longitachi committed Sep 30, 2017
1 parent e50781c commit 1037e1f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 29 deletions.
11 changes: 7 additions & 4 deletions PhotoBrowser/ZLCollectionCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,16 @@ - (void)restartCapture

- (void)startCapture
{
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];

if (![UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera]) {
UIImagePickerControllerSourceTypeCamera] ||
status == AVAuthorizationStatusRestricted ||
status == AVAuthorizationStatusDenied) {
return;
}


if (self.session && [self.session isRunning]) {
return;
}
Expand Down Expand Up @@ -277,9 +282,7 @@ - (void)startCapture
[self.previewLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
[self.contentView.layer insertSublayer:self.previewLayer atIndex:0];

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self.session startRunning];
});
[self.session startRunning];
}

- (AVCaptureDevice *)backCamera {
Expand Down
2 changes: 1 addition & 1 deletion PhotoBrowser/ZLPhotoActionSheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by long on 15/11/25.
// Copyright © 2015年 long. All rights reserved.
//
//pods version 2.4.3 - 2017.9.22 update
//pods version 2.4.5 - 2017.9.28 update

#import <UIKit/UIKit.h>
#import "ZLDefine.h"
Expand Down
11 changes: 2 additions & 9 deletions PhotoBrowser/ZLShowBigImgViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -500,15 +500,8 @@ - (void)handlerSingleTap
{
_hideNavBar = !_hideNavBar;

UIEdgeInsets inset = UIEdgeInsetsZero;
if (@available(iOS 11, *)) {
inset = self.view.safeAreaInsets;
}
CGFloat navHeight = inset.top+44;
CGRect navFrame = _hideNavBar?CGRectMake(0, -navHeight, kViewWidth, navHeight):CGRectMake(0, 0, kViewWidth, navHeight);
CGRect frame = _hideNavBar?CGRectMake(0, kViewHeight, kViewWidth, 44+inset.bottom):CGRectMake(0, kViewHeight-44-inset.bottom, kViewWidth, 44+inset.bottom);
_navView.frame = navFrame;
_bottomView.frame = frame;
_navView.hidden = _hideNavBar;
_bottomView.hidden = _hideNavBar;
}

#pragma mark - UICollectionDataSource
Expand Down
9 changes: 2 additions & 7 deletions PhotoBrowser/ZLThumbnailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ typedef NS_ENUM(NSUInteger, SlideSelectType) {
@interface ZLThumbnailViewController () <UICollectionViewDataSource, UICollectionViewDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, UIViewControllerPreviewingDelegate>
{
BOOL _isLayoutOK;
BOOL _haveTakePic;

//设备旋转前的第一个可视indexPath
NSIndexPath *_visibleIndexPath;
Expand Down Expand Up @@ -92,7 +91,7 @@ - (void)dealloc
}];
});
} else {
if (nav.allowTakePhotoInLibrary && nav.allowSelectImage) {
if (nav.allowTakePhotoInLibrary && nav.allowSelectImage && self.albumListModel.isCameraRoll) {
self.allowTakePhoto = YES;
}
[ZLPhotoManager markSelcectModelInArr:self.albumListModel.models selArr:nav.arrSelectedModels];
Expand Down Expand Up @@ -621,11 +620,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell
cell.layer.masksToBounds = YES;
cell.layer.cornerRadius = nav.cellCornerRadio;
if (nav.showCaptureImageOnTakePhotoBtn) {
if (!_isLayoutOK || _haveTakePic) {
[cell restartCapture];
} else {
[cell startCapture];
}
[cell startCapture];
}
return cell;
}
Expand Down
4 changes: 2 additions & 2 deletions ZLPhotoBrowser.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@
INFOPLIST_FILE = ZLPhotoBrowser/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = ZL.Bluetooth;
PRODUCT_BUNDLE_IDENTIFIER = ZL.ABC;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1;
};
Expand All @@ -563,7 +563,7 @@
INFOPLIST_FILE = ZLPhotoBrowser/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = ZL.Bluetooth;
PRODUCT_BUNDLE_IDENTIFIER = ZL.ABC;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1;
};
Expand Down
12 changes: 6 additions & 6 deletions ZLPhotoBrowser/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.3.1</string>
<string>2.4.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSCameraUsageDescription</key>
<string>是否允许访问你的相机?</string>
<key>NSPhotoLibraryUsageDescription</key>
Expand All @@ -44,11 +49,6 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
Expand Down

0 comments on commit 1037e1f

Please sign in to comment.