Skip to content

Conversation

@kmishukov
Copy link

@kmishukov kmishukov commented Apr 2, 2019

I have added constraints that fix bug, when FaveButton is untouchable when it is added to navigation bar as UIBarButtonItem(customView: FaveButton), this problem occurred on iOS 11 and higher.

class ViewController: UIViewController, FaveButtonDelegate {
 
    let myButton = FaveButton(frame: CGRect(x: 0, y: 0, width: 24, height: 24),
                              faveIconNormal: UIImage(named: "star"))
    
    override func viewDidLoad() {
        super.viewDidLoad()
        myButton.delegate = self
        navigationItem.rightBarButtonItem = UIBarButtonItem(customView: myButton)
    }
    
    func faveButton(_ faveButton: FaveButton, didSelected selected: Bool) {
        print("Button pressed!")
    }
}

ezgif-1-f46038bad9d0

Added constraints that fix button being untouchable when FaveButton was added to navigation bar as UIBarButtonItem(customView: FaveButton).
@joshhopkins
Copy link

Can this be merged please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants