[置顶] swift 给导航增加item,实现界面的跳转


//给导航增加item
        var rightItem = UIBarButtonItem(title: "First", style: UIBarButtonItemStyle.Plain, target: self, action: "fisrtItem:")
        rightItem.title = "First"
        self.navigationItem.rightBarButtonItem = rightItem


点击事件

func fisrtItem(right:UIBarButtonItem)
    {
        var vc = ViewController2()
        
        self.navigationController?.pushViewController(vc, animated: true)
    }
   

你可能感兴趣的:(ios,swift,导航,界面)