Created
July 25, 2015 14:21
-
-
Save TheFinestArtist/cbdbcd49eaedfb60cca4 to your computer and use it in GitHub Desktop.
CRToast+Custom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CRToast+Custom.h | |
// Custom | |
// | |
// Created by The Finest Artist | |
// | |
// | |
#import <CRToast/CRToast.h> | |
@interface CRToastManager (Custom) | |
+ (void)showWithMessage:(NSString *)message; | |
+ (void)errorWithMessage:(NSString *)message; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CRToast+Custom.m | |
// Custom | |
// | |
// Created by The Finest Artist | |
// | |
// | |
#import "CRToastManager+Custom.h" | |
@implementation CRToastManager (Custom) | |
+ (void)showWithMessage:(NSString *)message { | |
CRToastInteractionResponder *responder = [CRToastInteractionResponder interactionResponderWithInteractionType:CRToastInteractionTypeAll | |
automaticallyDismiss:YES | |
block:^(CRToastInteractionType interactionType) {}]; | |
NSDictionary *options = @{ | |
kCRToastNotificationTypeKey : @(CRToastTypeNavigationBar), | |
kCRToastNotificationPresentationTypeKey : @(CRToastPresentationTypeCover), | |
kCRToastUnderStatusBarKey : @(NO), | |
kCRToastImageKey : [UIImage imageNamed:@"alert_icon.png"], | |
kCRToastTextKey : message, | |
kCRToastFontKey : [UIFont systemFontOfSize:16.f], | |
kCRToastTextAlignmentKey : @(NSTextAlignmentLeft), | |
kCRToastBackgroundColorKey : UIColorFromRGB(kColorGray), | |
kCRToastTextAlignmentKey : @(NSTextAlignmentCenter), | |
kCRToastTextMaxNumberOfLinesKey : @(2), | |
kCRToastTimeIntervalKey : @(1.5f), | |
kCRToastAnimationInTypeKey : @(CRToastAnimationTypeGravity), | |
kCRToastAnimationOutTypeKey : @(CRToastAnimationTypeLinear), | |
kCRToastAnimationInDirectionKey : @(CRToastAnimationDirectionTop), | |
kCRToastAnimationOutDirectionKey : @(CRToastAnimationDirectionTop), | |
kCRToastInteractionRespondersKey : [NSArray arrayWithObject:responder] | |
}; | |
[CRToastManager showNotificationWithOptions:options completionBlock:nil]; | |
} | |
+ (void)errorWithMessage:(NSString *)message { | |
CRToastInteractionResponder *responder = [CRToastInteractionResponder interactionResponderWithInteractionType:CRToastInteractionTypeAll | |
automaticallyDismiss:YES | |
block:^(CRToastInteractionType interactionType) {}]; | |
NSDictionary *options = @{ | |
kCRToastNotificationTypeKey : @(CRToastTypeNavigationBar), | |
kCRToastNotificationPresentationTypeKey : @(CRToastPresentationTypeCover), | |
kCRToastUnderStatusBarKey : @(NO), | |
kCRToastImageKey : [UIImage imageNamed:@"alert_icon.png"], | |
kCRToastTextKey : message, | |
kCRToastFontKey : [UIFont systemFontOfSize:16.f], | |
kCRToastTextAlignmentKey : @(NSTextAlignmentLeft), | |
kCRToastBackgroundColorKey : UIColorFromRGB(kColorRed), | |
kCRToastTextAlignmentKey : @(NSTextAlignmentCenter), | |
kCRToastTextMaxNumberOfLinesKey : @(2), | |
kCRToastTimeIntervalKey : @(1.5f), | |
kCRToastAnimationInTypeKey : @(CRToastAnimationTypeGravity), | |
kCRToastAnimationOutTypeKey : @(CRToastAnimationTypeLinear), | |
kCRToastAnimationInDirectionKey : @(CRToastAnimationDirectionTop), | |
kCRToastAnimationOutDirectionKey : @(CRToastAnimationDirectionTop), | |
kCRToastInteractionRespondersKey : [NSArray arrayWithObject:responder] | |
}; | |
[CRToastManager showNotificationWithOptions:options completionBlock:nil]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment