修复订单来源弹窗打开时的图片预览展示
This commit is contained in:
@ -119,6 +119,30 @@ class BaseViewController: UIViewController {
|
||||
navigationController?.popViewController(animated: true)
|
||||
}
|
||||
|
||||
/// 沿 presentation 链找到当前最顶层控制器,避免 Sheet 已展示时 present 冲突。
|
||||
func topMostPresentedViewController() -> UIViewController {
|
||||
var top: UIViewController = self
|
||||
while let presented = top.presentedViewController {
|
||||
top = presented
|
||||
}
|
||||
return top
|
||||
}
|
||||
|
||||
/// 在当前可见 presentation 链顶端弹出页面。
|
||||
func presentOnTop(
|
||||
_ viewController: UIViewController,
|
||||
animated: Bool = true,
|
||||
completion: (() -> Void)? = nil
|
||||
) {
|
||||
topMostPresentedViewController().present(viewController, animated: animated, completion: completion)
|
||||
}
|
||||
|
||||
/// 全屏预览网络图片。
|
||||
func presentImagePreview(imageURLs: [String], startIndex: Int) {
|
||||
guard !imageURLs.isEmpty else { return }
|
||||
presentOnTop(ImagePreviewViewController(imageURLs: imageURLs, startIndex: startIndex))
|
||||
}
|
||||
|
||||
// MARK: - Notifications
|
||||
|
||||
private func registerBaseNotifications() {
|
||||
|
||||
Reference in New Issue
Block a user