Skip to content

Commit

Permalink
最低支持iOS13系统
Browse files Browse the repository at this point in the history
  • Loading branch information
mg459046365 committed Oct 28, 2022
1 parent 7c70371 commit 35aad57
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions BYImagePreview.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'BYImagePreview'
s.version = '1.0.4'
s.version = '1.0.5'
s.summary = '简易图片预览器'

# This description is used to generate tags and improve search results.
Expand All @@ -28,8 +28,8 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/mg459046365/BYImagePreview.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

s.ios.deployment_target = '10.0'
s.platform = :ios, '10.0'
s.ios.deployment_target = '13.0'
s.platform = :ios, '13.0'
s.swift_version = '5.0'
s.swift_versions = ['5.0']

Expand Down
15 changes: 10 additions & 5 deletions BYImagePreview/Classes/BYImagePreviewView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ public class BYImagePreviewView: UIViewController {
/// 从某个视图弹出
private var fromView: UIImageView?

private lazy var statusBarHeight: CGFloat = {
let manger = UIApplication.shared.windows.first { $0.isKeyWindow }?.windowScene?.statusBarManager
return manger?.statusBarFrame.height ?? 0
}()

override public func viewDidLoad() {
super.viewDidLoad()
setupView()
Expand All @@ -131,7 +136,6 @@ public class BYImagePreviewView: UIViewController {
private func setupView() {
view.backgroundColor = .black
view.isUserInteractionEnabled = true
automaticallyAdjustsScrollViewInsets = false
view.addSubview(collectionView)
view.addSubview(pageControl)
view.addSubview(countLabel)
Expand Down Expand Up @@ -225,7 +229,8 @@ public class BYImagePreviewView: UIViewController {
view.backgroundColor = UIColor.black.withAlphaComponent(0)
collectionView.isHidden = true

UIApplication.shared.keyWindow?.addSubview(view)
let keyWindow = UIApplication.shared.windows.first { $0.isKeyWindow }
keyWindow?.addSubview(view)
collectionView.frame = view.bounds
controller.addChild(self)

Expand Down Expand Up @@ -391,7 +396,7 @@ public class BYImagePreviewView: UIViewController {
}()

private lazy var tipLabel: UILabel = {
let lb = UILabel(frame: CGRect(x: 10, y: UIApplication.shared.statusBarFrame.height + 20, width: 100, height: 25))
let lb = UILabel(frame: CGRect(x: 10, y: statusBarHeight + 20, width: 100, height: 25))
lb.center = CGPoint(x: view.bounds.width / 2, y: lb.center.y)
lb.font = UIFont.systemFont(ofSize: 18)
lb.textAlignment = .center
Expand All @@ -403,7 +408,7 @@ public class BYImagePreviewView: UIViewController {
}()

private lazy var countLabel: UILabel = {
let lb = UILabel(frame: CGRect(x: 10, y: UIApplication.shared.statusBarFrame.height + 20, width: 100, height: 25))
let lb = UILabel(frame: CGRect(x: 10, y: statusBarHeight + 20, width: 100, height: 25))
lb.center = CGPoint(x: view.bounds.width / 2, y: lb.center.y)
lb.font = UIFont.systemFont(ofSize: 18)
lb.textAlignment = .center
Expand Down Expand Up @@ -646,7 +651,7 @@ class BYImagePreviewCell: UICollectionViewCell {
}()

private lazy var loadingView: UIActivityIndicatorView = {
let v = UIActivityIndicatorView(style: .whiteLarge)
let v = UIActivityIndicatorView(style: .large)
v.hidesWhenStopped = true
v.center = CGPoint(x: bounds.width / 2, y: bounds.height / 2)
return v
Expand Down
Loading

0 comments on commit 35aad57

Please sign in to comment.