一.创建导航

    let VC=ViewController()
    let navigationC = UINavigationController(rootViewController: VC)
    self.window?.rootViewController=navigationC
    self.window?.backgroundColor=UIColor.white

二.导航栏标题颜色

self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor:UIColor.white];

三.导航条颜色

self.navigationController?.navigationBar.barTintColor = UIColor.white;

四.设置导航左右点击按钮

右:

let rightButton = UIButton(type: UIButtonType.custom)
        rightButton.frame = CGRect(x: 0, y: 0, width: 33, height: 32)
        rightButton.addTarget(self,action:#selector(ViewController.buttonAtion),for:UIControlEvents.touchUpInside)
        rightButton.setTitle("123", for: UIControlState.normal)
        let rightItem = UIBarButtonItem(customView: rightButton)
        self.navigationItem.rightBarButtonItem = rightItem

点击事件:

@objc func buttonAtion(button:UIButton){
          print("22按钮点击了")
      }

swift - 导航设置总结加深记忆的更多相关文章

  1. UE4 Navmesh 室内导航设置

    我用的UE版本是4.14.1   系统:win10 64 前不久给样板房里面做了一个扫地机器人,导航设置让我头大了很久,度娘也没有用,最后在谷哥上有所感悟,现在给出本人的设置过程和解决方案. 一开始拖 ...

  2. Swift 导航栏设置图片点击事件,图片蓝色的解决方案

    如果导航栏想做一个点击事件,正好是一个图片 我们可以直接这样: self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIIm ...

  3. Swift 导航栏设置

    let width = UIScreen.mainScreen().bounds.size.width let height = UIScreen.mainScreen().bounds.size.h ...

  4. Swift 圆角设置

    故事面板中设置圆角(storyboard) Key Path layer.borderWidth(边框宽度) layer.cornerRadius(圆角弧度) layer.borderColor(边框 ...

  5. swift导航栏导航按钮添加多个按钮事件

    //导航左边返回按钮 let button1 = UIButton(frame:CGRectMake(0, 0, 18, 18)) button1.setImage(Constant.Image.Na ...

  6. dede导航设置成单页面内容

    有时顶级导航可能就是一个单页面 如公司简介 联系我们等 方法一:直接在导航栏填写内容 常规设置 二高级选项设置模板 三 填写页面内容 四 模板页面调用 内容 可在栏目模板中用{dede:field.c ...

  7. Swift - 导航条(UINavigationBar)的使用

    与导航控制器(UINavigationController)同时实现导航条和页面切换功能不同. 导航条(UINavgationBar)可以单独使用,添加至任何的UIView中.UINavigation ...

  8. ros机器人导航设置原点,目标点

    之前利用movebase导航定位都是通过rviz用鼠标指来指去,实验时非常方便,但实际应用总不能也人工指来指去吧,这怎么体现智能呢 启动导航后,用以前使用的rviz设设置目标点来获取map坐标系下的位 ...

  9. 重新温习,不但可以让自己对js更加的深刻认识,又能加深记忆,至此每天一次复习记录在此。

    Undefined类型,它只有一个值就是它本身,打个比方你在声明变量的时候又未对变量赋值也就是相关初始化操作,那么此刻该变量的值便是Undefined. var a//声明一个变量. console. ...

随机推荐

  1. c# 键值对的方式post提交

    DataContractJsonSerializer jsQcData = new DataContractJsonSerializer(typeof(DATA<data>));//DAT ...

  2. Codeforces Beta Round #65 (Div. 2)

    Codeforces Beta Round #65 (Div. 2) http://codeforces.com/contest/71 A #include<bits/stdc++.h> ...

  3. Codeforces Round #541 (Div. 2)

    Codeforces Round #541 (Div. 2) http://codeforces.com/contest/1131 A #include<bits/stdc++.h> us ...

  4. nodemcu生成LUA版本固件

    构建自己的固件地址 https://nodemcu-build.com/

  5. Server2003+IIS6+TP-Link+花生壳配置

    Server2003+IIS6+TP-Link+花生壳配置外网一共分四步: 固定Server2003电脑的局域网IP地址. 设置IIS网站中的TCP端口. 在TP-Link中设置转发规则. 申请花生壳 ...

  6. Linux磁盘挂载详述

    1.查看硬盘信息及分区 一般使用”fdisk -l”命令可以列出系统中当前连接的硬盘,设备和分区信息.新硬盘没有分区信息,则只显示硬盘大小信息. [root@localhost home]# fdis ...

  7. 创建smartfroms页格式

    1.输入TCODE:spad 2.页格式:完全管理  ---> 设备类型 ---> 页格式 ---> 创建 3.比如:长:24.2cm 宽:11.5cm 则设置:纸宽:115MM 纸 ...

  8. win下Apache2.4的下载与安装

    1.到apache官网上下载apache的安装文件 http://httpd.apache.org/download.cgi   点击链接Files for Microsoft Windows,因为a ...

  9. PhotoSphereViewer 全景图

    1网站地址:http://photo-sphere-viewer.js.org/markers.html#demo 2参数中文地址:https://www.cnblogs.com/big-tree/p ...

  10. js sort

    排序算法 比较的过程必须通过函数抽象出来.通常规定,对于两个元素x和y,如果认为x < y,则返回-1,如果认为x == y,则返回0,如果认为x > y,则返回1,这样,排序算法就不用关 ...