仅具有“后退"按钮和透明背景的导航 [英] Navigation with only Back Button and transparent background

查看:80
本文介绍了仅具有“后退"按钮和透明背景的导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾尝试实现嵌入到我的View Controller中的Navigation Controller.它按预期工作.

I had tried to implement Navigation Controller which embeds in my View Controller. It works as expected.

但是我的要求略有不同,它只需要一个后退按钮,并且在所有屏幕中都已经有一个带有徽标图像背景的顶部横幅.因此,如果我尝试实现后退按钮,它将占用导航栏的空间,该导航栏覆盖了徽标/顶部横幅.

But my requirement is slightly different which needs only a back button and already have a top banner with logo image background in all the screens . So if I try to implement back button it takes the space for the navigation bar which covers the Logo/top banner.

有什么办法可以克服这种情况.

Is there any way to overcome this scenario .

推荐答案

通过我的应用程序中使用的以下代码,这似乎也很容易:-

That seems pretty easy, by the following code used in my app too:-

self.navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.translucent = true
self.navigationController?.view.backgroundColor = UIColor.clearColor()

修改:-

要删除后退按钮文本:-

To remove back button text:-

navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .Plain, target: nil, action: nil)

Swift 3.0

self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.view.backgroundColor = UIColor.clear

这篇关于仅具有“后退"按钮和透明背景的导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆