Music_Player3/MusicPlayer/MP/MPPositive/ViewControllers/Base(基类,导航栏,标签栏)/MPPositive_NavigationController.swift
2024-05-11 09:48:37 +08:00

43 lines
1.9 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// MPPositive_NavigationController.swift
// MusicPlayer
//
// Created by Mr.Zhou on 2024/4/19.
//
import UIKit
///b
class MPPositive_NavigationController: MP_NavigationController {
//pushViewController
//pushpushviewControllerhidesBottomBarWhenPushed
override func pushViewController(_ viewController: UIViewController, animated: Bool) {
viewController.hidesBottomBarWhenPushed = true
super.pushViewController(viewController, animated: true)
viewController.hidesBottomBarWhenPushed = false
}
//popViewController
//viewControllerpushviewController
//viewControllerpopviewController
override func popViewController(animated: Bool) -> UIViewController? {
guard self.children.count != 1 else {
//pop
return super.popViewController(animated: true)
}
guard self.children.count == 2 else {
//viewControllerViewControllerhidesBottomBarWhenPushed = true
//tabbar
let count = self.children.count-2
let controller = self.children[count]
controller.hidesBottomBarWhenPushed = true
NotificationCenter.notificationKey.post(notificationName: .sideA_hidden_show)
return super.popViewController(animated: true)
}
//viewControllerViewController
//tabbar
let controller:UIViewController = self.children[0]
controller.hidesBottomBarWhenPushed = false
return super.popViewController(animated: true)
}
}