首页 > 代码库 > swift 给导航添加item,实现界面的跳转

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)
    }
   

swift 给导航添加item,实现界面的跳转