`
yidongkaifa
  • 浏览: 4060918 次
文章分类
社区版块
存档分类
最新评论

GCDiscreetNotificationView提示视图

 
阅读更多

GCDiscreetNotificationView 类库作用是: 在不阻止用户与设备应用程序交互情况下,作为一个通知视图来显示一个当前的状态。

GCDiscreetNotificationView 类库下载地址https://github.com/gcamp/GCDiscreetNotificationView


在开源中国iOS客户端上,当无法获取网络时,



我们常用的通知可能是一个UIAlertView的警告,提示当前网络未连接,这样就强制用户必须做出选择,被强制的肯定会不爽。这是GCDiscreetNotificationView类库相比较的一个优点;



关于怎样使用GCDiscreetNotificationView第三方类库,在开源中国iOS客户端中,这个开发类库被封装在一个Tool类中(Helper文件夹下),


  1. +(void)ToastNotification:(NSString*)textandView:(UIView*)viewandLoading:(BOOL)isLoadingandIsBottom:(BOOL)isBottom
  2. {
  3. GCDiscreetNotificationView*notificationView=[[GCDiscreetNotificationViewalloc]initWithText:textshowActivity:isLoadinginPresentationMode:isBottom?GCDiscreetNotificationViewPresentationModeBottom:GCDiscreetNotificationViewPresentationModeTopinView:view];
  4. [notificationViewshow:YES];
  5. [notificationViewhideAnimatedAfter:2.6];
  6. }

然后在MessageSystemView.m的reload方法中调用也就一行代码,当然其他类中也可以调用,只需#import "Tool.h"

[Tool ToastNotification:@"错误网络无连接" andView:self.view andLoading:NO andIsBottom:NO];


GCDiscreetNotificationView类库不仅可以在顶部显示,还可以在底部显示,只需修改andIsBottom:传入的BOOL型参数为YES,这样它就在底部显示了。andLoading接受BOOL型参数用于显示一个加载过程。


我将这个类库放到另一个工程中,仿照开源中国iOS客户端里的方法用Tool类进行封装,做的一个测试


底部显示



从中我们应该能体会到使用第三方类库好处了吧,我们不需要研究它是如何实现,知道有这个特效,然后只需调用接口就可;



正在学习过程中,错误之处请指正,欢迎交流,共同学习;

欢迎转载分享,请注明出处http://blog.csdn.net/duxinfeng2010


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics