TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jul 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by leefenghy.
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
UINavigationController.swizzle()
}
// 不支持侧滑true
isInteractivePopDisable = true
// 隐藏当前页面导航
self.isPrefersNavigationBarHidden = true
DispatchQueue.once(token: Static.token) {
let originalSelector = #selector(UINavigationController.pushViewController(_:animated:))
let swizzlerSelector = #selector(UINavigationController.myPushViewController(_:animated:))
let originalMethod = class_getInstanceMethod(UINavigationController.self, originalSelector)
let swizzlerMethod = class_getInstanceMethod(UINavigationController.self, swizzlerSelector)
//在进行 Swizzling 的时候,需要用 class_addMethod 先进行判断一下原有类中是否有要替换方法的实现
let isAddMethod = class_addMethod(UINavigationController.self, originalSelector, method_getImplementation(swizzlerMethod), method_getTypeEncoding(swizzlerMethod))
if isAddMethod
{
class_replaceMethod(UINavigationController.self, swizzlerSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod))
}else {
method_exchangeImplementations(originalMethod, swizzlerMethod)
}
}
DispatchQueue.once(token: Static.token) {
let originalSelector = #selector(UIViewController.viewWillAppear(_:))
let swizzlerSelector = #selector(UIViewController.myViewWillApper(_:))
let originalMethod = class_getInstanceMethod(self, originalSelector)
let swizzlerMethod = class_getInstanceMethod(self, swizzlerSelector)
let isAddMethod: Bool = class_addMethod(self, originalSelector, method_getImplementation(swizzlerMethod), method_getTypeEncoding(swizzlerMethod))
if isAddMethod
{
class_replaceMethod(self, swizzlerSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod))
}else {
method_exchangeImplementations(originalMethod, swizzlerMethod)
}
let disappear_originalSEL = #selector(UIViewController.viewWillDisappear(_:))
let disappear_swizzleSEL = #selector(UIViewController.myViewWillDisappear(_:))
let disappear_originalMethod = class_getInstanceMethod(self, disappear_originalSEL)
let disappear_swizzleMethod = class_getInstanceMethod(self, disappear_swizzleSEL)
let isAdd: Bool = class_addMethod(self, disappear_originalSEL, method_getImplementation(disappear_swizzleMethod), method_getTypeEncoding(disappear_swizzleMethod))
if isAdd {
class_replaceMethod(self, disappear_swizzleSEL, method_getImplementation(disappear_originalMethod), method_getTypeEncoding(disappear_originalMethod))
}else {
method_exchangeImplementations(disappear_originalMethod, disappear_swizzleMethod)
}
}
error: failed to push some refs to '[email protected]:LeeFengHY/SwiftFullScreenPop.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
是因为远程repository和我本地的repository冲突导致的,如下解决方法:
git pull origin master
git push -u origin master
git branch [name]
git push -u origin [name]