如何全局自定义后退按钮?
有没有一种简单的方法(委托?覆盖?)全局自定义整个应用程序中 navigationBar
中使用的所有后退按钮?
最佳
–f
is there a simple way (Delegation? Overwriting?) do globally customize all the back buttons that are being used in the navigationBar
throughout my whole app?
Best
–f
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您能更具体地说明一下您的目标吗?对于大多数在全局范围内更改对象行为的尝试,您可以“调配”一个或多个方法,即切换为您的家庭烹饪提供的实现。如果不知道您想要实现什么目标,就不可能知道这是否对您有用。
在这种情况下,请考虑创建一个导航控制器工厂方法(可能作为您创建的类上的类方法,但您也可以在
UINavigationController
上的类别中执行此操作,该方法返回配置为的导航控制器实例每当您需要 UINavigationController 时,请调用该工厂方法而不是默认的初始化程序。Could you be more specific about your goal? For most attempts to change an object's behviour globally, you can 'swizzle' one or more methods, that is, switch the supplied implementation for your home cooking. It's not possible to know if that can work for you without knowing what you want to achieve.
In that case, consider creating a navigation controller factory method (probably as a class method on a class of your creation, but you could also do it in a category on
UINavigationController
that returns a navigation controller instance configured to your liking. Whenever you need aUINavigationController
, call that factory method instead of the default initialiser.