Sfoglia il codice sorgente

IPULib中的KRVideoPlayerControlView中的closeButton的刘海屏适配。

huangyl3 5 anni fa
parent
commit
162468f56a

+ 14 - 0
IpuLib/IpuLib.xcodeproj/xcuserdata/huangyulin.xcuserdatad/xcschemes/xcschememanagement.plist

@ -0,0 +1,14 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
<plist version="1.0">
4
<dict>
5
	<key>SchemeUserState</key>
6
	<dict>
7
		<key>IPULib.xcscheme_^#shared#^_</key>
8
		<dict>
9
			<key>orderHint</key>
10
			<integer>0</integer>
11
		</dict>
12
	</dict>
13
</dict>
14
</plist>

+ 8 - 1
IpuLib/IpuLib/KRVideoPlayer/Classes/KRVideoPlayerControlView.m

@ -13,6 +13,13 @@ static const CGFloat kVideoControlAnimationTimeinterval = 0.3;
13 13
static const CGFloat kVideoControlTimeLabelFontSize = 10.0;
14 14
static const CGFloat kVideoControlBarAutoFadeOutTimeinterval = 5.0;
15 15
16
#define IPHONE_X \
17
({BOOL isPhoneX = NO;\
18
if (@available(iOS 11.0, *)) {\
19
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
20
}\
21
(isPhoneX);})
22
16 23
@interface KRVideoPlayerControlView ()
17 24
18 25
@property (nonatomic, strong) UIView *topBar;
@ -57,7 +64,7 @@ static const CGFloat kVideoControlBarAutoFadeOutTimeinterval = 5.0;
57 64
- (void)layoutSubviews
58 65
{
59 66
    [super layoutSubviews];
60
    self.topBar.frame = CGRectMake(CGRectGetMinX(self.bounds), CGRectGetMinY(self.bounds), CGRectGetMaxX(self.bounds), kVideoControlBarHeight);
67
    self.topBar.frame = CGRectMake(CGRectGetMinX(self.bounds), CGRectGetMinY(self.bounds) + (IPHONE_X?34:0), CGRectGetMaxX(self.bounds), kVideoControlBarHeight);
61 68
    self.closeButton.frame = CGRectMake(CGRectGetMaxX(self.bounds) - CGRectGetMaxX(self.closeButton.bounds), CGRectGetMinX(self.bounds), CGRectGetMaxX(self.closeButton.bounds), CGRectGetMaxY(self.closeButton.bounds));
62 69
    self.bottomBar.frame = CGRectMake(CGRectGetMinX(self.bounds), CGRectGetMaxY(self.bounds) - kVideoControlBarHeight, CGRectGetMaxX(self.bounds), kVideoControlBarHeight);
63 70
    self.playButton.frame = CGRectMake(CGRectGetMinX(self.bottomBar.bounds), CGRectGetMaxY(self.bottomBar.bounds)/2 - CGRectGetMaxY(self.playButton.bounds)/2, CGRectGetMaxX(self.playButton.bounds), CGRectGetMaxY(self.playButton.bounds));