[翻译] GCDiscreetNotificationView

简介:

GCDiscreetNotificationView

GCDiscreetNotificationView is a discreet, non-modal, notification view for iOS. You can use it to show an activity or state of you app without blocking the user interactions.

GCDiscreetNotificationView是一个设计精细,通知类型的view,你可以用来标示一种状态,而不会阻塞用户交互。

GCDiscreetNotificationView features:

GCDiscreetNotificationView的特性:

  • Easy to use : init and show 使用很简单,初始化,然后显示
  • Can show an activity indicator 可以显示动态状态更新
  • Two presentation mode (top and bottom) 两种展示方式(顶部和底部)
  • All properties (text, activity and presentation mode) can be changed in a animated fashion 所有属性(文本,指示器以及显示方式)都可以动态改变

 

Usage

(See the demo project included)

(请先看一下demo)

You simply allocate the notification view with one of the following methods.

你可以使用下面的任何一种初始化方法来显示通知的view。

The parameters are the following :

下面的参数:

  • text : the text presented on the notification 通知展示用的文本
  • activity : if set to YES, the notification with show a activity indicator 如果设置成YES,则会显示出指示器
  • aPresentationMode : the presentation mode of the notification (top or bottom) 设置展示通知的方式
  • aView : the view that will contain the notification. The view should be able to accept subviews (will not work on a UITableView for example) 可以接受通知view的容器view,这个view能够接受并合理的显示出subviews(这个不会在TableView上面显示哦)
- (id) initWithText:(NSString *)text inView:(UIView *)aView;
- (id) initWithText:(NSString *)text showActivity:(BOOL)activity inView:(UIView *)aView;
- (id) initWithText:(NSString *)text showActivity:(BOOL)activity inPresentationMode:(GCDiscreetNotificationViewPresentationMode) aPresentationMode inView:(UIView *)aView;

You show or hide the notification with these methods. The showAndDismissAutomaticallyAnimated will hide your notification automatically after 1 second.

你可以用下面的方法来隐藏或者显示这些方法。showAndDismissAutomaticallyAnimated 会在1s后自动隐藏你的通知view。

- (void) showAnimated;
- (void) hideAnimated;
- (void) hideAnimatedAfter:(NSTimeInterval) timeInterval;
- (void) show:(BOOL) animated;
- (void) hide:(BOOL) animated;
- (void) showAndDismissAutomaticallyAnimated;
- (void) showAndDismissAfter:(NSTimeInterval) timeInterval;

You can change the text of the label of the activity viewing at any moment with these properties.

你可以在任意时刻修改label上的文本。

@property (nonatomic, assign) UIView *view;
@property (nonatomic, assign) GCDiscreetNotificationViewPresentationMode presentationMode;
@property (nonatomic, copy) NSString* textLabel;
@property (nonatomic, assign) BOOL showActivity;

These properties can be changed in a animated fashion (except the view).

下面这些属性可以动态修改(修改的时候会有动画)。

- (void) setTextLabel:(NSString *) aText animated:(BOOL) animated;
- (void) setShowActivity:(BOOL) activity animated:(BOOL) animated;
- (void) setTextLabel:(NSString *)aText andSetShowActivity:(BOOL)activity animated:(BOOL)animated;
- (void) setPresentationMode:(GCDiscreetNotificationViewPresentationMode) newPresentationMode animated:(BOOL) animated;

You can access directly the notification’s label and activity indicator. And change some propreties on that label and activity indicator. If you want to change the label’s text or hide the indicator, use textLabel or showActivity instead.

你也可以直接的操作通知上面的label以及状态指示器。也可以直接修改这些属性上面的文本以及指示器,如果你想要修改label上面的文本,或者是隐藏指示器,使用textLabel或者是showActivity来代替。

@property (nonatomic, retain, readonly) UILabel *label;  
@property (nonatomic, retain, readonly) UIActivityIndicatorView *activityIndicator;

 

目录
相关文章
|
7月前
|
Java 调度 Maven
新一代 Cron-Job 分布式任务调度平台 正式发布!
简单易用、超低延迟,支持用户权限管理、多语言客户端和多租户接入的分布式任务调度平台。 支持任何Cron表达式的任务调度,支持常用的分片和随机策略;支持失败丢弃、失败重试的失败策略;支持动态任务参数。
325 103
|
10月前
|
数据可视化 Python
Pandas 相关性分析
Pandas 相关性分析
171 1
|
11月前
|
运维 安全 物联网
物联网:NB卡在使用过程中存在的一些限制和需要特别注意的操作事项
物联网NB卡(通常指的是窄带物联网(NarrowBand Internet of Things, NB-IoT)卡)是专为物联网设备设计的无线通信模块,主要用于连接物联网设备与移动网络,实现远程数据交换和控制。然而,在使用物联网NB卡时,确实存在一些限制和操作上的考虑因素。以下是一些主要的限制和操作注意事项:
|
11月前
|
机器学习/深度学习 C# 索引
HashMap的容量为什么一定是2^n?
`HashMap` 的容量设计为 `2^n` 主要出于三个考虑:1) 位运算效率高,通过 `(hash & (capacity - 1))` 快速计算索引;2) 元素分布均匀,减少哈希冲突,提高性能;3) 扩容时只需检查最高位,简化重分布过程,提升扩容效率。初始容量为 `1 << 4`(16),扩容以2倍递增。
281 0
HashMap的容量为什么一定是2^n?
|
机器学习/深度学习 算法 TensorFlow
TensorFlow Probability 超厉害!带你探索贝叶斯方法与概率编程,开启数据科学新征程!
【8月更文挑战第31天】TensorFlow Probability是基于TensorFlow的一个强大库,专攻概率建模与推断,融合深度学习力量与概率方法灵活性,便于构建复杂概率模型并高效推断。它提供了概率分布、贝叶斯推断等工具,支持不确定性量化与决策,尤其适合数据有限情况。通过示例代码展示了如何构建贝叶斯线性回归模型,体现了其在处理不确定性方面的优势。
291 1
|
人工智能 Windows
恢复消失的“Windows 照片查看器“
通过编辑Windows注册表来恢复右键菜单中消失的“Windows 照片查看器”,通过添加新的字符串值来关联图片文件类型,使得“Windows 照片查看器”重新出现在右键菜单中。
301 0
恢复消失的“Windows 照片查看器“
|
存储 固态存储 Java
浅析企业级SSD Multi-Stream Write技术
Multi-stream write(多流写)技术可以使SSD根据主机端提供的Stream ID,将具有相同或相似生命周期的数据写入到相同的擦除单元中去,大大提高了GC时的效率,减少了写放大,使得SSD的性能和寿命都有了较大的提升。
|
网络协议
如何开放云服务器端口
如何开放云服务器端口
356 0
|
SQL 传感器 存储
Flink之多流转换(分流、合流) 2
Flink之多流转换(分流、合流)
457 0
|
运维 Devops 测试技术
[译]SRE 简介,和 DevOps 的关系和异同
在组织结构中引入网站可靠性工程(SRE)团队,在IT行业和DevOps领域越来越受欢迎。让我们在本文中探讨SRE流行的原因以及DevOps和SRE之间的区别和共同点。
492 0
[译]SRE 简介,和 DevOps 的关系和异同