护舒宝

 

简单自定义UIToolBar

 let item1 = UIBarButtonItem(title: "分享", style: .Plain, target: self, action: nil)
        let item2 = UIBarButtonItem(barButtonSystemItem: .Pause, target: self, action: nil)
        let item3 = UIBarButtonItem(image: UIImage(named: "main_badge@3x"), style: .Plain, target: self, action: nil)
        
        // 弹簧
        let space = UIBarButtonItem(barButtonSystemItem: .FlexibleSpace, target: self, action: nil)
        
        let customToolBar = UIToolbar(frame: CGRectMake(0,300,self.view.frame.size.width,44))
        
        customToolBar.setItems([item1,space,item2,space,item3], animated: true)
        
        self.view.addSubview(customToolBar)

 

posted on 2015-12-09 16:14  护舒宝  阅读(294)  评论(0)    收藏  举报

导航