[IOS 消息提醒]--网络或操作的成功失败提醒AJNotificationView
来源:互联网 发布:linux中新建文件命令 编辑:程序博客网 时间:2024/05/15 00:05
https://github.com/ajerez/AJNotificationView
AJNotificationView
Notice component for iOS
- No images needed, all CoreGraphics code
- Works on iPhone and iPad (resolution independent)
- Animated background type
- Only one notification is shown at a time. When a notification is created, it is added to the queue. If it is the only notification in the queue, then its delay interval is honored. If it is not the only notification in the queue, it is placed at the end of the queue, and then displayed without a delay once it reaches the front of the queue (Thanks to @DazeEnd).
Video demo
Example Usage
Add QuartzCore.framework and drop the AJNotificationView folder in your project
//Blue notification with animated lined background. Hides after 2,5 seg[AJNotificationView showNoticeInView:self.view type:AJNotificationTypeBlue title:@"Test notification" linedBackground:AJLinedBackgroundTypeAnimated hideAfter:2.5f];
// Orange notification without lined background. Remains visible until the user taps in it, or you call hide methodAJNotificationView *panel = [AJNotificationView showNoticeInView:self.view type:AJNotificationTypeOrange title:@"Test notification" linedBackground:AJLinedBackgroundTypeDisabled hideAfter:0];//Your code[panel hide];
// Notification with delay, offset and response block that's called when the user tap in it.//Thanks to @DazeEnd for this awesome features[AJNotificationView showNoticeInView:self.view type:AJNotificationTypeBlue title:@"Oppa Gangnam Style!" linedBackground:AJLinedBackgroundTypeDisabled hideAfter:2.5f offset:50.0f delay:1.0f response:^{ NSLog(@"User tap in the notification"); } ];
// Notification with delay, offset, response block and detail disclosure button that send a notification when the user tap in it//Thanks to @smoothdvd for this last feature//In viewDidLoad register the NSNotification- (void)viewDidLoad{ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(detailDisclosureButtonPressed:) name:@"detail_disclosure_button_pressed" object:nil]; [super viewDidLoad];}//...//Function that's called when the NSNotification is fired- (void)detailDisclosureButtonPressed:(NSNotification*)notification{ NSLog(@"Detail disclosure button pressed");}//...//The code for show the AJNotificationView [AJNotificationView showNoticeInView:self.view type:AJNotificationTypeBlue title:@"Detail disclosure notification" linedBackground:AJLinedBackgroundTypeAnimated hideAfter:2.5f offset:0.0f delay:0.0f detailDisclosure:YES response:^{ NSLog(@"Response block"); } ];
There are several notification styles to choose from:
AJNotificationTypeDefault
<-- GrayAJNotificationTypeBlue
AJNotificationTypeRed
AJNotificationTypeGreen
AJNotificationTypeOrange
And background types:
AJLinedBackgroundTypeDisabled
AJLinedBackgroundTypeStatic
<-- DefaultAJLinedBackgroundTypeAnimated
Future improvements
- Code rafactoring
- More background colors (Notification styles)
Inspiration
- Thanks to Eli Perkins for YRDropDownView
- Thanks to Tito Ciuro for NoticeView
Contact
Twitter: @alberto_jrz
License - MIT
Copyright (c) 2012 Alberto Jerez - CodeApps
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- [IOS 消息提醒]--网络或操作的成功失败提醒AJNotificationView
- [IOS]消息提醒--TSMessages
- [IOS消息提醒]--- DMRNotificationView
- [IOS消息提醒]--CMNavBarNotificationView
- [IOS消息提醒]---MPNotificationView
- [IOS 消息提醒]--状态栏FDStatusBarNotifierView
- 博客或论坛中 消息通知提醒 怎么实现的?
- [IOS 消息提醒]--状态条上提醒信息- WTStatusBar
- 类似msn的消息提醒
- Viewbadger消息提醒的实现
- 关于js的消息提醒
- 消息提醒小红点的实现
- IOS下本地消息提醒UILocalNotification
- iOS关于聊天消息提醒铃声
- VIM的替换+提醒操作
- iOS客户端的升级提醒
- iOS 的更新提醒教程
- 无论是成功的时候,还是失败的时候,都要时刻提醒自己。
- Pinterest谈实战经验:如何在两年内实现零到数百亿的月访问
- linux内核参数查看与修改
- hdu 1598 find the most comfortable road(枚举+并查集)
- cannot simultaneously fetch multiple bags 问题的解决办法
- Eclipse+Weblogic 12开发简单的Enterprise Application
- [IOS 消息提醒]--网络或操作的成功失败提醒AJNotificationView
- Android 实现再按一次后退键退出应用程序
- 黑马程序员--Java基础加强1
- 正则表达式(三) Pattern和Matcher
- 排序算法之二交换排序
- hdu Minimum Inversion Number---树状数组求正序数与逆序数
- jdbc 优化
- 组合框设置高度
- android4.0 禁止横竖屏切换使用 android:configChanges="orientation|keyboardHidden"无效