易于使用,半透明且具有模糊效果的在 UIView
,UITableView
,UICollectionView
中设置的提醒视图。同时支持显示进度。
支持 iOS 7 和 iOS 8。需要 Xcode 6。
[CSNotificationView showInViewController:self
style:CSNotificationViewStyleError
message:@"A critical error happened."];
[CSNotificationView showInViewController:self
style:CSNotificationViewStyleSuccess
message:@"Great, it works."];
CSNotificationView* note = (...);
note.showingActivity = YES;
[note setVisible:YES animated:YES completion:nil];
(...)
[note dismissWithStyle:CSNotificationViewStyleSuccess message:@"Success!"
duration:kCSNotificationViewDefaultShowDuration animated:YES];
使用块回调处理通知的点击事件
__block typeof(self) weakSelf = self;
self.loadingNotificationView.tapHandler = ^{
[weakSelf cancelOperationXYZ];
[weakSelf.loadingNotificationView dismissWithStyle:CSNotificationViewStyleError
message:@"Cancelled"
duration:kCSNotificationViewDefaultShowDuration animated:YES];
};
note.image = [UIImage imageNamed:@"mustache"];
[CSNotificationView showInViewController:self
tintColor:[UIColor colorWithRed:0.000 green:0.6 blue:1.000 alpha:1]
image:nil
message:@"No icon and a message that needs two rows and extra \
presentation time to be displayed properly."
duration:5.8f];
查看 LICENSE.md