CSNotificationView 0.5.4

CSNotificationView 0.5.4

测试被测试
语言语言 Objective-CObjective C
许可证 MIT
发布最后发布2015年3月

Christian Schwarz 维护。



  • Christian Schwarz

易于使用、半透明且模糊的通知视图,可以轻松地添加到 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 回调来处理通知上的点击事件

    __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