swift3 - UIImageView as UINavigationBarItem -


i have profile image being downloaded app, put on uiimageview rounded (this part works ok).

now wanted add uiimageview navigationbar

profileimageview.loadimage(urlstring: photourl, completion: {         print("loaded image from: ", photourl)         let barbutton = uibarbuttonitem(customview: self.profileimageview)         barbutton.target = self         barbutton.action = #selector(self.handleprofileclick)         barbutton.style = .plain         self.navigationitem.leftbarbuttonitem = barbutton     }) 

the handle method simple print:

@objc func handleprofileclick() {     print("clicked button") } 

the image view build this:

let profileimageview: cachedimageview  = {     let iv = cachedimageview()     iv.layer.borderwidth = 1     iv.layer.maskstobounds = false     iv.layer.bordercolor = stylemanager.theme().cgcolor     iv.frame = cgrect(x: 0, y: 0, width: 35, height: 35)     iv.layer.cornerradius = iv.frame.size.width/2     iv.clipstobounds = true     iv.contentmode = .scaleaspectfit     return iv }() 

the cachedimageview class extends uiimageview , has methods download image url , cache image if not exist in cache (this works fine).

i can see line print on console means functions being executed , being added navbar display's, when click button nothing happens... seems me action never triggered.

thanks in advance.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -