ios - How I get the image of a button in swift? -


i set image button using code

func imagepickercontroller(_ picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [string : any]) {       let chosenimage = info[uiimagepickercontrolleroriginalimage] as! uiimage           btnimg1.contentmode = .scaleaspectfit         btnimg1.setimage(chosenimage, for: uicontrolstate.normal)  dismiss(animated: true, completion: nil) } 

now how can selected image or mean how image of button? want image save somewhare.. please , in advance

uibutton contain imageview, , when assign image uiimageview can .image property

so uibutton imageview , image

button.imageview?.image give image assigned uibutton if button have different image state can use .

    button.image(for: .normal or ever state)     button.imageview?.image    

(both give same result if set image .normal)

enter image description here

@rooh al-mahaba can access property of uiimageview if have uibutton object uibutton contain uiimageview handle image related part


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -