[IOS消息提醒]--- DMRNotificationView


https://github.com/tursunovic/DMRNotificationView


DMRNotificationView

DMRNotificationView is a simple panel that slides down to inform the user about something. It has a title and subtitle (optional). You can set custom tint colors (automatically adds 0.85 transparency to tint color), fonts and dismiss interval.

DMRNotificationView

Installation

  • Add the DMRNotificationView.h + DMRNotificationView.m to your project

Usage

Usage is pretty self-explanatory if you check the demo. DMRNotificationView can be used in different ways. It comes with a few convenience initializers which allow you to present the panel in one line of code. See the header file for more methods.

// 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"];

You can use the default initialiser for advanced usage.

// 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];

Issues

  • Layout issue when changing interface orientation
  • Title can only be one line, no support for long titles

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值