#import <Foundation/Foundation.h>
@interface AlertCenter : NSObject
+ (void)alertButtonMessage:(NSString *)message;
+ (void)alertToastMessage:(NSString *)message;
+ (void)alertNavBarGreenMessage:(NSString *)message;
+ (void)alertNavBarYellowMessage:(NSString *)message;
@end
#import "CRToast.h"
#import "AlertCenter.h"
#import "PromptMessage.h"
@implementation AlertCenter
+ (void)alertButtonMessage:(NSString *)message
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:message delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
[alertView show];
}
+ (void)alertToastMessage:(NSString *)message
{
PromptMessage *pbMessage = [[PromptMessage alloc] init];
[pbMessage showMessage:message];
}
+ (void)alertNavBarGreenMessage:(NSString *)message
{
[AlertCenter alertNavBarMessage:message color:UIColorFromRGB(11, 163, 42)];
}
+ (void)alertNavBarYellowMessage:(NSString *)message
{
[AlertCenter alertNavBarMessage:message color:UIColorFromRGB(255, 153, 0)];
}
+ (void)alertNavBarMessage:(NSString *)message color:(UIColor *)color
{
NSDictionary *options = @{
kCRToastNotificationTypeKey : @(CRToastTypeNavigationBar),
kCRToastNotificationPresentationTypeKey : @(CRToastPresentationTypeCover),
kCRToastUnderStatusBarKey : @(YES),
kCRToastTextKey : message,
kCRToastTextAlignmentKey : @(NSTextAlignmentCenter),
kCRToastBackgroundColorKey : color,
kCRToastAnimationInTypeKey : @(CRToastAnimationTypeGravity),
kCRToastAnimationOutTypeKey : @(CRToastAnimationTypeGravity),
kCRToastAnimationInDirectionKey : @(CRToastAnimationDirectionTop),
kCRToastAnimationOutDirectionKey : @(CRToastAnimationDirectionTop)
};
[CRToastManager showNotificationWithOptions:options
completionBlock:^{
NSLog(@"AlertNavBarMessage completed");
}];
}
@end