I currently have a custom navigation controller with panel elements that are just text buttons. Is it possible to save the title of the panel elements and also set them as images (icon image + name at the bottom).
class NavigationController: UINavigationController { var mode: NavigationMode = .Swipe { didSet { self.setButtonAttributes() } } private var leftBarButton: UIBarButtonItem! private var middleBarButton: UIBarButtonItem! private var rightBarButton: UIBarButtonItem! private var rightBarButton2: UIBarButtonItem! override func viewDidLoad() { super.viewDidLoad() } func configureNavigationItem(navigationItem: UINavigationItem) {
Updated:
let button = UIButton(type: .System) button.setImage(UIImage(named: "play"), forState: .Normal) button.setTitle("Play", forState: .Normal) button.sizeToFit() leftBarButton = UIBarButtonItem(customView: button) if (self.leftBarButton == nil) { self.leftBarButton = UIBarButtonItem(title: "Play", style: .Plain,target: self, action: "Pressed:") }
source share