Constraint custom view en navigation controllers

//Navigation buttons // * * Profile self.ivProfile = UIImageView(frame: CGRect(x: 0, y: 0, width: 40, height: 40)) self.ivProfile.image = #imageLiteral(resourceName: "iconDefaultUser") self.ivProfile.round() //extension let widthConstraint = self.ivProfile.widthAnchor.constraint(equalToConstant: 40) let heightConstraint = self.ivProfile.heightAnchor.constraint(equalToConstant: 40) heightConstraint.isActive = true widthConstraint.isActive = true let btnItemProfile = UIBarButtonItem(customView: ivProfile) btnItemProfile.target = self btnItemProfile.action = #selector(self.openProfile) self.navigationItem.leftBarButtonItem = btnItemProfile //Extension of view func round() { self.layer.cornerRadius = self.frame.width / 2 self.clipsToBounds = true }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.