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)
@rooh al-mahaba can access property of uiimageview if have uibutton object uibutton contain uiimageview handle image related part
Comments
Post a Comment