DMRNotificationView 1.1

DMRNotificationView 1.1

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

Yuriy Pitomets 维护。



  • Damir Tursunovic,Shan Ul Haq 和 Yuriy Pitomets

DMRNotificationView 是一个简单的面板,可以向下滑动来通知用户某一件事。它有一个标题(可选)和副标题。您可以设置自定义色调颜色(自动添加 0.85 透明度到色调颜色)、字体和消失间隔。

DMRNotificationView

安装

  • DMRNotificationView.h + DMRNotificationView.m 添加到您的项目中

用法

检查演示后,用法则非常直观。DMRNotificationView 可以以不同的方式使用。它包含一些便利的初始化器,允许您在一行代码中呈现面板。有关更多方法,请参阅头文件。

// The most basic method. 
[DMRNotificationView showInView:self.view
                          title:@"Simple notification"
                       subTitle:@"This method allows you to quickly show a notification panel."];

// Use a similar method to show a warning 
[DMRNotificationView showWarningInView:self.view
                               title:@"Warning!"
                            subTitle:@"Simple method to quickly show a warning"];

您可以使用默认初始化器进行高级使用。

// Create a new DMRNotificationView instance with the default initializer
DMRNotificationView *notificationView = [[DMRNotificationView alloc] initWithTitle:@"Some title" subTitle:@"Some subtitle" targetView:self.view];

// Customise fonts
[notificationView setTitleFont:[UIFont fontWithName:@"MarkerFelt-Thin" size:20.0]];
[notificationView setSubTitleFont:[UIFont fontWithName:@"MarkerFelt-Thin" size:13.0]];

// Customise the time interval which causes the panel to dismiss. Set to 0.0 to disable auto dismiss
[notificationView setHideTimeInterval:6.0];    

// Set a custom tint color. If tint color is bright, the text will be dark, otherwise white. Tint color can't be clearColor or nil
[notificationView setTintColor:[UIColor greenColor]];

// Optionally disable transparency
[notificationView setIsTransparent:NO];   

[notificationView setDidTapHandler:^() {
    // be notified when user taps on panel
}];

[notificationView showAnimated:YES];

问题

  • 更改界面方向时的布局问题
  • 标题只能是一行,不支持长标题