swift - Add an Icon to the SDCAlertView -
i installed sdcalertview project cocoapods because need add icon text on left hand side alertaction, have question how can add image (icon) alertaction on left hand side in sdcalertview? here code :
func alert() {      let alertcontroller = alertcontroller(title: "alert controller", message: "message alert", preferredstyle: .actionsheet)     let alertcancel = alertaction(title: "cancel", style: .preferred, handler: nil)     let alertok = alertaction(title: "ok", style: .normal, handler: nil)               let paragraphstyle = nsmutableparagraphstyle()             // here key thing!             paragraphstyle.alignment = .left              let messagetext = nsmutableattributedstring(                 string: "video",                 attributes: [                     nsparagraphstyleattributename: paragraphstyle,                     nsfontattributename : uifont.preferredfont(fortextstyle: .headline),                     nsforegroundcolorattributename : uicolor.black                 ]             )       let image = uiimage(named: "video.png")     alertok.setvalue(image, forkey: "image")      alertok.setvalue(messagetext, forkey: "attributedtitle")      alertcontroller.add(alertok)     alertcontroller.add(alertcancel)     alertcontroller.present() }   but error message ('[ setvalue:forundefinedkey:]: class not key value coding-compliant key image.')
how can fix issue
thank
sdcalertview not support adding icon "out of box", have add image view content view.
this question's code should started: adding constraints in sdcalertview
just make sure add constraints contentview mentioned in accepted answer.
Comments
Post a Comment