Commit 0283a2f9f6164910b8d8387a18b247c5f1d06906
1 parent
c5ac356c
提交适配更改
Showing
3 changed files
with
39 additions
and
15 deletions
CNLiveImagePickerController/CNImagePickerCommonDefine.h
| ... | ... | @@ -45,4 +45,38 @@ alpha:a] |
| 45 | 45 | #define kFriendsCircle_limit_video_max 10*60 //朋友圈限制最大视频编辑10分钟 |
| 46 | 46 | |
| 47 | 47 | |
| 48 | + | |
| 49 | +//////////////////////////////////////////////////////// | |
| 50 | +//////////// SCreen | |
| 51 | +//////////////////////////////////////////////////////// | |
| 52 | +#define kIPScreenWidth ([UIScreen mainScreen].bounds.size.width > [UIScreen mainScreen].bounds.size.height ? [UIScreen mainScreen].bounds.size.height : [UIScreen mainScreen].bounds.size.width) | |
| 53 | +#define kIPScreenHeight ([UIScreen mainScreen].bounds.size.width > [UIScreen mainScreen].bounds.size.height ? [UIScreen mainScreen].bounds.size.width : [UIScreen mainScreen].bounds.size.height) | |
| 54 | + | |
| 55 | + | |
| 56 | +//判断iPHoneXr | |
| 57 | +#define IP_Device_Is_iPhoneXS_XR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO) | |
| 58 | + | |
| 59 | +//判断iPHoneX、iPHoneXs | |
| 60 | +#define IP_Device_Is_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) | |
| 61 | +#define IP_Device_Is_iPhoneXS ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) | |
| 62 | + | |
| 63 | +//判断iPhoneXs Max | |
| 64 | +#define IP_Device_Is_iPhoneXS_MAX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) : NO) | |
| 65 | + | |
| 66 | +#define IP_IS_IPhoneX_All (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 812)) ||CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(812, 375)) ||CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(414, 896)) ||CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(896, 414))) | |
| 67 | + | |
| 68 | + | |
| 69 | +#define kIPStatusHeight (int)[UIApplication sharedApplication].statusBarFrame.size.height //x44 非x20 | |
| 70 | +#define kIPNavigationBarHeight ((int)[UIApplication sharedApplication].statusBarFrame.size.height+44) //x88 非x64 | |
| 71 | +#define kIPVerticalNaviBarHeight ((IP_IS_IPhoneX_All > 0) ? 88 : 44) | |
| 72 | +#define kIPVerticalTabBarTotalHeight ((IP_IS_IPhoneX_All > 0) ? 83 : 49) | |
| 73 | +#define kIPVerticalBottomSafeHeight ((IP_IS_IPhoneX_All > 0) ? 34 : 0) | |
| 74 | +#define kIPVerticalStatusHeight ((IP_IS_IPhoneX_All > 0) ? 44 : 20) | |
| 75 | +#define kIPVerticalTopHeight ((IP_IS_IPhoneX_All > 0) ? 24 : 0) | |
| 76 | +#define kIPHorizontalTopNaviBarHeight 32 | |
| 77 | +#define kIPHorizontalBottomHeight ((IP_IS_IPhoneX_All > 0) ? 21 : 0) | |
| 78 | +#define kIPHorizontalLeftHeight ((IP_IS_IPhoneX_All > 0) ? 44 : 0) | |
| 79 | +#define kIPHorizontalRightHeight ((IP_IS_IPhoneX_All > 0) ? 44 : 0) | |
| 80 | +#define kIPHorizontalTopHeight ((IP_IS_IPhoneX_All > 0) ? 24 : 0) | |
| 81 | + | |
| 48 | 82 | #endif /* CNImagePickerCommonDefine_h */ | ... | ... |
CNLiveImagePickerController/CNImagePickerController.m
| ... | ... | @@ -242,7 +242,7 @@ |
| 242 | 242 | [self setPhotoPickerPageDidLayoutSubviewsBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) { |
| 243 | 243 | |
| 244 | 244 | CGRect frame = bottomToolBar.frame; |
| 245 | - doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15, 60, 30); | |
| 245 | + doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kIPVerticalBottomSafeHeight /2), 60, 30); | |
| 246 | 246 | |
| 247 | 247 | CGRect originalPhotoLabelFrame = originalPhotoLabel.frame; |
| 248 | 248 | CGFloat originalX = (bottomToolBar.frame.size.width - originalPhotoLabelFrame.size.width) /2; |
| ... | ... | @@ -255,21 +255,21 @@ |
| 255 | 255 | [self setPhotoPreviewPageDidLayoutSubviewsBlock:^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) { |
| 256 | 256 | |
| 257 | 257 | CGRect frame = toolBar.frame; |
| 258 | - doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15, 60, 30); | |
| 258 | + doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kIPVerticalBottomSafeHeight /2), 60, 30); | |
| 259 | 259 | |
| 260 | 260 | }]; |
| 261 | 261 | //视频预览 |
| 262 | 262 | [self setVideoPreviewPageDidLayoutSubviewsBlock:^(UIButton *playButton, UIView *toolBar, UIButton *doneButton) { |
| 263 | 263 | |
| 264 | 264 | CGRect frame = toolBar.frame; |
| 265 | - doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15, 60, 30); | |
| 265 | + doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kIPVerticalBottomSafeHeight /2), 60, 30); | |
| 266 | 266 | |
| 267 | 267 | }]; |
| 268 | 268 | //gif预览 |
| 269 | 269 | [self setGifPreviewPageDidLayoutSubviewsBlock:^(UIView *toolBar, UIButton *doneButton) { |
| 270 | 270 | |
| 271 | 271 | CGRect frame = toolBar.frame; |
| 272 | - doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15, 60, 30); | |
| 272 | + doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kIPVerticalBottomSafeHeight /2), 60, 30); | |
| 273 | 273 | |
| 274 | 274 | }]; |
| 275 | 275 | //相册cell | ... | ... |
CNLiveImagePickerController/TZImagePickerController.m
| ... | ... | @@ -892,17 +892,7 @@ |
| 892 | 892 | @implementation TZCommonTools |
| 893 | 893 | |
| 894 | 894 | + (BOOL)tz_isIPhoneX { |
| 895 | - struct utsname systemInfo; | |
| 896 | - uname(&systemInfo); | |
| 897 | - NSString *platform = [NSString stringWithCString:systemInfo.machine encoding:NSASCIIStringEncoding]; | |
| 898 | - if ([platform isEqualToString:@"i386"] || [platform isEqualToString:@"x86_64"]) { | |
| 899 | - // 模拟器下采用屏幕的高度来判断 | |
| 900 | - return (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 812)) || | |
| 901 | - CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(812, 375))); | |
| 902 | - } | |
| 903 | - // iPhone10,6是美版iPhoneX 感谢hegelsu指出:https://github.com/banchichen/TZImagePickerController/issues/635 | |
| 904 | - BOOL isIPhoneX = [platform isEqualToString:@"iPhone10,3"] || [platform isEqualToString:@"iPhone10,6"]; | |
| 905 | - return isIPhoneX; | |
| 895 | + return (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 812)) ||CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(812, 375)) ||CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(414, 896)) ||CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(896, 414))); | |
| 906 | 896 | } |
| 907 | 897 | |
| 908 | 898 | + (CGFloat)tz_statusBarHeight { | ... | ... |