我正在尝试处理UI导航栏上的后退按钮的按下。我在目标C中有一个扩展(https://github.com/onegray/UIViewController-BackButtonHandler),我已经使用标头将其桥接到我在Swift中的项目中,现在我还不太清楚如何在Swift中实现代码。这是在C中的实现:
-(BOOL) navigationShouldPopOnBackButton {
if(needsShowConfirmation) {
// Show confirmation alert
// ...
return NO; // Ignore 'Back' button this time
}
return YES; // Process 'Back' button click and Pop view controler
}
func navigationShouldPopOnBackButton() -> Bool {
if(needsShowConfirmation) {
// Show confirmation alert
// ...
return false // Ignore 'Back' button this time
}
return true // Process 'Back' button click and Pop view controller
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句