CRToast icon indicating copy to clipboard operation
CRToast copied to clipboard

Setting an image in swift

Open ianbarrera opened this issue 10 years ago • 2 comments

Is there a way to set an image in swift?

this is the dictionary supplied

var options: NSDictionary = [ kCRToastTextKey : "Me lleva la mierda", kCRToastAnimationInDirectionKey : CRToastAnimationDirection.Top.rawValue, kCRToastAnimationInTypeKey : CRToastAnimationType.Gravity.rawValue, kCRToastAnimationOutDirectionKey : CRToastAnimationDirection.Top.rawValue, kCRToastAnimationOutTypeKey : CRToastAnimationType.Gravity.rawValue, kCRToastNotificationPresentationTypeKey : CRToastPresentationType.Push.hashValue, kCRToastNotificationTypeKey : CRToastType.NavigationBar.rawValue, kCRToastTextAlignmentKey : NSTextAlignment.Left.rawValue, kCRToastTimeIntervalKey : 1.0, kCRToastUnderStatusBarKey : NSNumber(bool: false), kCRToastBackgroundColorKey : UIColor.redColor(), kCRToastImageKey : UIImage(named:"alert-off") ]

it sends an error from dictionary definition

ianbarrera avatar Mar 25 '15 08:03 ianbarrera

could you post the error please?

Ashton-W avatar Mar 25 '15 08:03 Ashton-W

@iandamecsican : This seems to do the trick:

options[kCRToastImageKey] = UIImage(named: "ic_whatever") as AnyObject?

alexcosmin avatar May 27 '15 23:05 alexcosmin