|
@@ -8,8 +8,8 @@
|
|
|
|
|
|
// import MediaPlayer
|
|
|
import Alamofire
|
|
|
-import UIKit
|
|
|
import FDFullscreenPopGesture
|
|
|
+import UIKit
|
|
|
open class PQBaseViewController: UIViewController, UIGestureRecognizerDelegate {
|
|
|
// 侧滑拦截返回
|
|
|
public var popGestureHandle: (() -> Void)?
|
|
@@ -40,9 +40,7 @@ open class PQBaseViewController: UIViewController, UIGestureRecognizerDelegate {
|
|
|
public lazy var manager: NetworkReachabilityManager? = {
|
|
|
let manager = NetworkReachabilityManager(host: "www.baidu.com")
|
|
|
manager?.startListening(onQueue: DispatchQueue.global(), onUpdatePerforming: { status in
|
|
|
- if status == .reachable(.cellular) || status == .reachable(.ethernetOrWiFi) {
|
|
|
-
|
|
|
- }
|
|
|
+ if status == .reachable(.cellular) || status == .reachable(.ethernetOrWiFi) {}
|
|
|
})
|
|
|
return manager
|
|
|
}()
|
|
@@ -79,19 +77,19 @@ open class PQBaseViewController: UIViewController, UIGestureRecognizerDelegate {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- open func leftBackButton() {
|
|
|
- leftButton(image: "icon_detail_back")
|
|
|
+ open func leftBackButton(image: UIImage? = nil) {
|
|
|
+ leftButton(image: image, imageName: "icon_detail_back")
|
|
|
}
|
|
|
|
|
|
- public func leftButton(image: String?, tintColor: UIColor? = nil) {
|
|
|
+ public func leftButton(image: UIImage? = nil, imageName: String? = nil, tintColor: UIColor? = nil) {
|
|
|
let leftButton = UIButton(type: .custom)
|
|
|
leftButton.frame = CGRect(x: 0, y: cDevice_iPhoneStatusBarHei, width: cDefaultMargin * 4, height: cDefaultMargin * 4)
|
|
|
leftButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: -5, right: 0)
|
|
|
if tintColor != nil {
|
|
|
leftButton.tintColor = tintColor
|
|
|
- leftButton.setImage(UIImage.moduleImage(named: "icon_detail_back", moduleName: "BFCommonKit")?.withRenderingMode(.alwaysTemplate), for: .normal)
|
|
|
+ leftButton.setImage((image ?? UIImage.moduleImage(named: imageName ?? "icon_detail_back", moduleName: "BFCommonKit"))?.withRenderingMode(.alwaysTemplate), for: .normal)
|
|
|
} else {
|
|
|
- leftButton.setImage(UIImage.moduleImage(named: "icon_detail_back", moduleName: "BFCommonKit"), for: .normal)
|
|
|
+ leftButton.setImage(image ?? UIImage.moduleImage(named: imageName ?? "icon_detail_back", moduleName: "BFCommonKit"), for: .normal)
|
|
|
}
|
|
|
leftButton.addTarget(self, action: #selector(backBtnClick), for: .touchUpInside)
|
|
|
navHeadImageView?.addSubview(leftButton)
|
|
@@ -191,7 +189,7 @@ open class PQBaseViewController: UIViewController, UIGestureRecognizerDelegate {
|
|
|
|
|
|
/// 拦截侧滑手势
|
|
|
/// - Returns: <#description#>
|
|
|
- @objc private func popGesture(panGes: UIPanGestureRecognizer) {
|
|
|
+ @objc private func popGesture(panGes: UIPanGestureRecognizer) {
|
|
|
if panGes.state == .ended, popGestureHandle != nil {
|
|
|
popGestureHandle!()
|
|
|
}
|