Setting an image in swift
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
could you post the error please?
@iandamecsican : This seems to do the trick:
options[kCRToastImageKey] = UIImage(named: "ic_whatever") as AnyObject?