美文网首页SwiftUI
SwiftUI 自定义导航栏

SwiftUI 自定义导航栏

作者: 韦德460 | 来源:发表于2021-05-17 10:16 被阅读0次

    相关Demo

    debug custom title view custom title view search
    leadingView&trailingView foreground hidden bottom line
    background image background linearGradient update background alpha
    intercept back event ignore top area

    使用方式举例

    struct ForegroundView: View {
        var body: some View {
            WRNavigationBar {
                ListView()
            }
            .title("set foreground")
            .foreground(.white)
            .isBackButtonBlack(false)
            .background(Color.blue)
        }
    }
    

    相关方法

    api description
    foreground(_ foreground: Color) foreground
    title(_ title: String) 标题(titleView is default)
    hiddenLine(_ hidden: Bool) 隐藏底部线
    backButtonImageName(_ named: String) 返回按钮图片资源名称
    backButtonHidden(_ hidden: Bool) 隐藏返回按钮
    isBackButtonBlack(_ isBlack: Bool) 黑色返回按钮(backButton is default)
    ignoringTopArea(_ ignore: Bool) 内容忽略导航栏顶部区域
    maxWidth(leading: CGFloat = 80, trailing: CGFloat = 80) leadingView 和 trailingView 最大宽度
    background<Background>(_ background: Background) background(任意视图)
    backButtonTapAction(_ tapAction: @escaping WRBlock) 拦截返回按钮事件( hasBackButton == true)
    debug(_ debug: Bool) debug(开启调试)
    navigationBarTitleView<Content: View>(@ViewBuilder titleView: () -> Content) titleView(任意视图)
    wrNavigationBarItems<Leading: View, Trailing: View>(leading:xx, trailing:xx) 导航栏 leading & trailing 视图
    wrNavigationBarItems<Content: View>(@ViewBuilder leading: () -> Content) 导航栏 leading 视图
    wrNavigationBarItems<Content>(trailing: () -> Content) 导航栏 trailing 视图

    详情地址

    https://github.com/wangrui460/SwiftUI-WRNavigationBar

    SwiftUI 技术交流群

    加我微信wr1204607318,拉你入群

    相关文章

      网友评论

        本文标题:SwiftUI 自定义导航栏

        本文链接:https://www.haomeiwen.com/subject/zmavrqtx.html