为 CocoaPods
简约、易于自定义的隐形应用通知。
自定义
使用方法
有几种方式来显示通知:使用本地化键或直接字符串
以下是方法签名和用法示例
- (void)setImageWithName:(NSString*)imageName forType:(SKNotificationType)type;
- (void)show:(SKNotificationType)type withMessage:(NSString*)message in:(UIViewController*)controller;
- (void)show:(SKNotificationType)type withLocalizedKey:(NSString *)key in:(UIViewController *)controller;
- (void)show:(SKNotificationType)type withMessage:(NSString*)message in:(UIViewController*)controller withCompletion:(void (^)(void))completion;
- (void)show:(SKNotificationType)type withLocalizedKey:(NSString *)key in:(UIViewController *)controller withCompletion:(void (^)(void))completion;
- (void)show:(SKNotificationType)type withMessage:(NSString*)message in:(UIViewController*)controller withCompletion:(void (^)(void))completion andCancelation:(void (^)(void))cancelation;
- (void)show:(SKNotificationType)type withLocalizedKey:(NSString *)key in:(UIViewController *)controller withCompletion:(void (^)(void))completion andCancelation:(void (^)(void))cancelation;
[[SKNotification centre] show:SKNSuccess
withMessage:@"Alert, your location is too far from the actual address."
in:self withCompletion:^{
NSLog(@"Completed 2");
}];
默认颜色下的样子,这些颜色可以完全自定义
通知类型
typedef NS_ENUM(NSInteger, SKNotificationType){
SKNSuccess,
SKNFailure,
SKNAlert,
SKNInfo,
SKNCustom
};
额外的动画选项
typedef NS_ENUM(NSInteger, SKAnimationType){
SKAnimationSmooth,
SKAnimationQuickDrop,
SKAnimationSlowDrop
};
额外的选项和使用方法
[[SKNotification centre] setImageWithName:@"alert" forType:SKNAlert];
[[SKNotification centre] setImageWithName:@"success" forType:SKNSuccess];
[[SKNotification centre] setImageWithName:@"failure" forType:SKNFailure];
[[SKNotification centre] setImageWithName:@"info" forType:SKNInfo];
[[SKNotification centre] setDisplayDuration:1.85f];
[[SKNotification centre] shouldDropShadow:YES];
[[SKNotification centre] setMessageFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:12.0f]];
[[SKNotification centre] setTransparent:NO];
[[SKNotification centre] setAlpha:1.0f];
[[SKNotification centre] setDisplayDuration:2.5f];
[[SKNotification centre] setMessageFont:[UIFont systemFontOfSize:13.0f]];
[[SKNotification centre] setUseAutomaticTextColor:YES];
[[SKNotification centre] setElastic:YES];