微信h5隐藏导航栏和状态栏_导航栏未在SwiftUI中隐藏

微信h5隐藏导航栏和状态栏

TL;DR: If you can’t tap on buttons in the navigation-bar area, you can jump directly to “4. The Solution” to fix the issue.

TL; DR:如果无法点击导航栏区域中的按钮,则可以直接跳至“ 4。 解决方案”。

If you’re not that rushed, feel free to read my full article with a cup of coffee.

如果您不那么着急,请随时阅读一杯咖啡来阅读我的全文。

1.要求 (1. The Requirements)

On a nice day, you’re tasked with implementing a custom navigation bar in your new iOS app. With SwiftUI, you’re confident you can get it done within just an hour because it’s really simple, as it needs only two buttons:

在美好的一天,您的任务是在新的iOS应用中实现自定义导航栏。 使用SwiftUI,您有信心可以在一个小时内完成它,因为它非常简单,因为它只需要两个按钮:

  • Back button: To let users go back to the previous screen

    后退按钮 :让用户返回上一屏幕

  • Close button: To let users dismiss the current flow and dismiss to the first screen of the flow

    关闭按钮 :让用户关闭当前流程并转到流程的第一个屏幕

Image for post
“Very simple,” you think
您认为“非常简单”

2.情况 (2. The Situation)

You might think of using native navigationBarItems to provide a leading item and trailing item, like this:

您可能会想到使用本机navigationBarItems提供前导项和尾随项,如下所示:

var body: some View {
       
VStack {
EmptyView()
}
.navigationBarItems(leading: backButton, trailing: closeButton)
.background(Color.white)
.edgesIgnoringSafeArea(.all)
}

With the back button as the leading button and the close button, you’re confident running the code. Oops! There’s another unexpected blue back button there.

使用后退按钮作为前导按钮,然后使用关闭按钮,您可以自信地运行代码。 糟糕! 那里还有一个意外的蓝色后退按钮。

Image for post
Oops! There’s another unexpected back button.
糟糕! 还有另一个意外的后退按钮。

Simple! You think, “We can hide the native back button in just a second!” Stop there for a moment — you already replaced the leading button as your custom back button. Why is the native bl

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值