DFNotificationView 0.5.4

DFNotificationView 0.5.4

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最新发布2015年2月

Ryan Cochrane 维护。



  • 作者:
  • Christian Schwarz

DFNotificationView 是 CSNotificationView 的分支

易于使用,半透明且具有模糊效果的在 UIViewUITableViewUICollectionView 中设置的提醒视图。同时支持显示进度。

支持 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."];

内置 UIActivityIndicatorView

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