Swift: 自定义UIBarButtonItem的customView
将UIButton添加至UIBarButtonItem
var button: UIButton = UIButton() button.setImage(UIImage(named: "cameraIconInactive"), forState: .Normal) button.frame = CGRectMake(0, 0, 45, 45) button.targetForAction("pushProfileToCamera", withSender: nil) var rightItem:UIBarButtonItem = UIBarButtonItem() rightItem.customView = button self.navigationItem.rightBarButtonItem = rightItem
文章评论