Skip to content

Commit 3a7e1cf

Browse files
committed
JDStatusBarNotification-改动了
1 parent 80c6055 commit 3a7e1cf

9 files changed

Lines changed: 1029 additions & 4 deletions

File tree

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@
131131
4E96E7E31A1B537E0037C098 /* icon_file_txt@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E96E7D51A1B537E0037C098 /* icon_file_txt@2x.png */; };
132132
4E96E7E41A1B537E0037C098 /* icon_file_xls@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E96E7D61A1B537E0037C098 /* icon_file_xls@2x.png */; };
133133
4E96E7E51A1B537E0037C098 /* icon_file_zip@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E96E7D71A1B537E0037C098 /* icon_file_zip@2x.png */; };
134+
4E996BC81ABA754600C704F1 /* JDStatusBarNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E996BC31ABA754600C704F1 /* JDStatusBarNotification.m */; };
135+
4E996BC91ABA754600C704F1 /* JDStatusBarStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E996BC51ABA754600C704F1 /* JDStatusBarStyle.m */; };
136+
4E996BCA1ABA754600C704F1 /* JDStatusBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E996BC71ABA754600C704F1 /* JDStatusBarView.m */; };
134137
4EA679031A11F18A001A0324 /* libUMessage_Sdk_1.1.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EA679011A11F18A001A0324 /* libUMessage_Sdk_1.1.0.a */; };
135138
4EA679061A130C24001A0324 /* icon_code_file@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EA679041A130C24001A0324 /* icon_code_file@2x.png */; };
136139
4EA679071A130C24001A0324 /* icon_code_tree@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EA679051A130C24001A0324 /* icon_code_tree@2x.png */; };
@@ -741,6 +744,12 @@
741744
4E96E7D51A1B537E0037C098 /* icon_file_txt@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_file_txt@2x.png"; sourceTree = "<group>"; };
742745
4E96E7D61A1B537E0037C098 /* icon_file_xls@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_file_xls@2x.png"; sourceTree = "<group>"; };
743746
4E96E7D71A1B537E0037C098 /* icon_file_zip@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_file_zip@2x.png"; sourceTree = "<group>"; };
747+
4E996BC21ABA754600C704F1 /* JDStatusBarNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JDStatusBarNotification.h; sourceTree = "<group>"; };
748+
4E996BC31ABA754600C704F1 /* JDStatusBarNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JDStatusBarNotification.m; sourceTree = "<group>"; };
749+
4E996BC41ABA754600C704F1 /* JDStatusBarStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JDStatusBarStyle.h; sourceTree = "<group>"; };
750+
4E996BC51ABA754600C704F1 /* JDStatusBarStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JDStatusBarStyle.m; sourceTree = "<group>"; };
751+
4E996BC61ABA754600C704F1 /* JDStatusBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JDStatusBarView.h; sourceTree = "<group>"; };
752+
4E996BC71ABA754600C704F1 /* JDStatusBarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JDStatusBarView.m; sourceTree = "<group>"; };
744753
4EA679011A11F18A001A0324 /* libUMessage_Sdk_1.1.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libUMessage_Sdk_1.1.0.a; sourceTree = "<group>"; };
745754
4EA679021A11F18A001A0324 /* UMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UMessage.h; sourceTree = "<group>"; };
746755
4EA679041A130C24001A0324 /* icon_code_file@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_code_file@2x.png"; sourceTree = "<group>"; };
@@ -1694,6 +1703,19 @@
16941703
path = icon_file;
16951704
sourceTree = "<group>";
16961705
};
1706+
4E996BC11ABA754600C704F1 /* JDStatusBarNotification */ = {
1707+
isa = PBXGroup;
1708+
children = (
1709+
4E996BC21ABA754600C704F1 /* JDStatusBarNotification.h */,
1710+
4E996BC31ABA754600C704F1 /* JDStatusBarNotification.m */,
1711+
4E996BC41ABA754600C704F1 /* JDStatusBarStyle.h */,
1712+
4E996BC51ABA754600C704F1 /* JDStatusBarStyle.m */,
1713+
4E996BC61ABA754600C704F1 /* JDStatusBarView.h */,
1714+
4E996BC71ABA754600C704F1 /* JDStatusBarView.m */,
1715+
);
1716+
path = JDStatusBarNotification;
1717+
sourceTree = "<group>";
1718+
};
16971719
4EA679001A11F18A001A0324 /* UMessage_Sdk_1.1.0 */ = {
16981720
isa = PBXGroup;
16991721
children = (
@@ -2611,6 +2633,7 @@
26112633
8EA6D03E19E240C40076D59C /* Vendor */ = {
26122634
isa = PBXGroup;
26132635
children = (
2636+
4E996BC11ABA754600C704F1 /* JDStatusBarNotification */,
26142637
4EBFBD0F1AA80AEE00E4B10E /* iVersion */,
26152638
4E6C411A1A846AC30098DC17 /* RFKeyboardToolbar */,
26162639
4E6D71841A75F00E005AD988 /* YLGIFImage */,
@@ -3299,6 +3322,7 @@
32993322
8EF643BF19FF7E2900F7EEB0 /* SettingTextCell.m in Sources */,
33003323
8E64ED8419ED0CE3006E99DA /* QBImagePickerGroupCell.m in Sources */,
33013324
4ECE8AE71A3943E80021E29C /* UITableView+Common.m in Sources */,
3325+
4E996BC81ABA754600C704F1 /* JDStatusBarNotification.m in Sources */,
33023326
4E6C411F1A846AC30098DC17 /* RFKeyboardToolbar.m in Sources */,
33033327
4E38CF621A7B7C99005536C0 /* CodeBranchOrTag.m in Sources */,
33043328
8EA6D1CF19E240C40076D59C /* ObjcRuntime.m in Sources */,
@@ -3460,6 +3484,7 @@
34603484
8E64ED8219ED0CE3006E99DA /* QBImagePickerController.m in Sources */,
34613485
4E6BA2E01A1EE6AF005FD721 /* AFURLResponseSerialization.m in Sources */,
34623486
8E59F1031A0120F1009A905F /* CodeFile.m in Sources */,
3487+
4E996BCA1ABA754600C704F1 /* JDStatusBarView.m in Sources */,
34633488
8EF643AD19FF7E2900F7EEB0 /* TweetMediaItemCCell.m in Sources */,
34643489
8EA6D23519E240C40076D59C /* ProjectListView.m in Sources */,
34653490
8E64ED7E19ED0CE3006E99DA /* QBAssetsCollectionVideoIndicatorView.m in Sources */,
@@ -3481,6 +3506,7 @@
34813506
4E217F111A70EDC700F6DF88 /* SVWebViewControllerActivityChrome.m in Sources */,
34823507
4EA6790D1A1461DC001A0324 /* ProjectFolder.m in Sources */,
34833508
8EF643BC19FF7E2900F7EEB0 /* ProjectActivityListCell.m in Sources */,
3509+
4E996BC91ABA754600C704F1 /* JDStatusBarStyle.m in Sources */,
34843510
8EF83F9419EB78CC00E86DE7 /* SettingTextViewController.m in Sources */,
34853511
8EA6D1B019E240C40076D59C /* Comment.m in Sources */,
34863512
4E8765651A22E5B40090CFB9 /* NSMutableArray+SWUtilityButtons.m in Sources */,
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
//
2+
// JDStatusBarNotification.h
3+
//
4+
// Based on KGStatusBar by Kevin Gibbon
5+
//
6+
// Created by Markus Emrich on 10/28/13.
7+
// Copyright 2013 Markus Emrich. All rights reserved.
8+
//
9+
10+
#import <UIKit/UIKit.h>
11+
12+
#import "JDStatusBarStyle.h"
13+
#import "JDStatusBarView.h"
14+
15+
/**
16+
* A block that is used to define the appearance of a notification.
17+
* A JDStatusBarStyle instance defines the notification appeareance.
18+
*
19+
* @param style The current default JDStatusBarStyle instance.
20+
*
21+
* @return The modified JDStatusBarStyle instance.
22+
*/
23+
typedef JDStatusBarStyle*(^JDPrepareStyleBlock)(JDStatusBarStyle *style);
24+
25+
/**
26+
* This class is a singletion which is used to present notifications
27+
* on top of the status bar. To present a notification, use one of the
28+
* given class methods.
29+
*/
30+
@interface JDStatusBarNotification : NSObject
31+
32+
#pragma mark Presentation
33+
34+
/**
35+
* Show a notification. It won't hide automatically,
36+
* you have to dimiss it on your own.
37+
*
38+
* @param status The message to display
39+
*
40+
* @return The presented notification view for further customization
41+
*/
42+
+ (JDStatusBarView*)showWithStatus:(NSString *)status;
43+
44+
/**
45+
* Show a notification with a specific style. It won't
46+
* hide automatically, you have to dimiss it on your own.
47+
*
48+
* @param status The message to display
49+
* @param styleName The name of the style. You can use any JDStatusBarStyle constant
50+
* (JDStatusBarStyleDefault, etc.), or a custom style identifier, after you added a
51+
* custom style. If this is nil, the default style will be used.
52+
*
53+
* @return The presented notification view for further customization
54+
*/
55+
+ (JDStatusBarView*)showWithStatus:(NSString *)status
56+
styleName:(NSString*)styleName;
57+
58+
/**
59+
* Same as showWithStatus:, but the notification will
60+
* automatically dismiss after the given timeInterval.
61+
*
62+
* @param status The message to display
63+
* @param timeInterval The duration, how long the notification
64+
* is displayed. (Including the animation duration)
65+
*
66+
* @return The presented notification view for further customization
67+
*/
68+
+ (JDStatusBarView*)showWithStatus:(NSString *)status
69+
dismissAfter:(NSTimeInterval)timeInterval;
70+
71+
/**
72+
* Same as showWithStatus:styleName:, but the notification
73+
* will automatically dismiss after the given timeInterval.
74+
*
75+
* @param status The message to display
76+
* @param timeInterval The duration, how long the notification
77+
* is displayed. (Including the animation duration)
78+
* @param styleName The name of the style. You can use any JDStatusBarStyle constant
79+
* (JDStatusBarStyleDefault, etc.), or a custom style identifier, after you added a
80+
* custom style. If this is nil, the default style will be used.
81+
*
82+
* @return The presented notification view for further customization
83+
*/
84+
+ (JDStatusBarView*)showWithStatus:(NSString *)status
85+
dismissAfter:(NSTimeInterval)timeInterval
86+
styleName:(NSString*)styleName;
87+
88+
#pragma mark Dismissal
89+
90+
/**
91+
* Calls dismissAnimated: with animated set to YES
92+
*/
93+
+ (void)dismiss;
94+
95+
/**
96+
* Dismisses any currently displayed notification immediately
97+
*
98+
* @param animated If this is YES, the animation style used
99+
* for presentation will also be used for the dismissal.
100+
*/
101+
+ (void)dismissAnimated:(BOOL)animated;
102+
103+
/**
104+
* Same as dismissAnimated:, but you can specify a delay,
105+
* so the notification wont be dismissed immediately
106+
*
107+
* @param delay The delay, how long the notification should stay visible
108+
*/
109+
+ (void)dismissAfter:(NSTimeInterval)delay;
110+
111+
#pragma mark Styles
112+
113+
/**
114+
* This changes the default style, which is always used
115+
* when a method without styleName is used for presentation, or
116+
* styleName is nil, or no style is found with this name.
117+
*
118+
* @param prepareBlock A block, which has a JDStatusBarStyle instance as
119+
* parameter. This instance can be modified to suit your needs. You need
120+
* to return the modified style again.
121+
*/
122+
+ (void)setDefaultStyle:(JDPrepareStyleBlock)prepareBlock;
123+
124+
/**
125+
* Adds a custom style, which than can be used
126+
* in the presentation methods.
127+
*
128+
* @param identifier The identifier, which will
129+
* later be used to reference the configured style.
130+
* @param prepareBlock A block, which has a JDStatusBarStyle instance as
131+
* parameter. This instance can be modified to suit your needs. You need
132+
* to return the modified style again.
133+
*
134+
* @return Returns the given identifier, so it can
135+
* be directly used as styleName parameter.
136+
*/
137+
+ (NSString*)addStyleNamed:(NSString*)identifier
138+
prepare:(JDPrepareStyleBlock)prepareBlock;
139+
140+
#pragma mark progress & activity
141+
142+
/**
143+
* Show the progress below the label.
144+
*
145+
* @param progress Relative progress from 0.0 to 1.0
146+
*/
147+
+ (void)showProgress:(CGFloat)progress;
148+
149+
/**
150+
* Shows an activity indicator in front of the notification text
151+
*
152+
* @param show Use this flag to show or hide the activity indicator
153+
* @param indicatorStyle Sets the style of the activity indicator
154+
*/
155+
+ (void)showActivityIndicator:(BOOL)show
156+
indicatorStyle:(UIActivityIndicatorViewStyle)style;
157+
158+
#pragma mark state
159+
160+
/**
161+
* This method tests, if a notification is currently displayed.
162+
*
163+
* @return YES, if a notification is currently displayed. Otherwise NO.
164+
*/
165+
+ (BOOL)isVisible;
166+
167+
@end
168+
169+

0 commit comments

Comments
 (0)