Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ab8f5f396 | |||
| 8fd82dcdc6 | |||
| d691134fea | |||
| 2fce7c8818 | |||
| 195e99c68d | |||
| 029ba7943c | |||
| 9c1d49b094 | |||
| 477c95fb94 | |||
| 4e12eb580f | |||
| e7d66aefe3 | |||
| 7eb79da4f0 | |||
| 0c103128dd | |||
| fac5c91daa | |||
| 5c949092f5 | |||
| cdc51f3243 | |||
| 7d1890f7c5 | |||
| 26d6eda4f5 | |||
| 9dfcc29703 | |||
| 6d00f770ef | |||
| 23a64f768d | |||
| e3fd1677b1 | |||
| dfbb1ed5f6 | |||
| 71aec53e1d | |||
| a24706854d | |||
| 9dd9bcecb2 | |||
| c5875f1311 | |||
| 6d2a139fa0 | |||
| 1a1d1c5d38 | |||
| b87af9f288 | |||
| 975ca58291 | |||
| d9d8c1d342 | |||
| e700d781cc | |||
| 6882883e21 | |||
| 00136b9d3c | |||
| 437e5c5860 | |||
| eef9cc818c | |||
| e9ba7bdeda | |||
| c70f81e35b | |||
| 7bae7b4ddc | |||
| bca16517c3 | |||
| f4432a86c7 | |||
| fa848141eb | |||
| d1b09abe48 | |||
| 36e5ea38b6 | |||
| c6fcfa1d2a | |||
| 70e603a058 | |||
| e488b4c76b | |||
| f1d9606940 | |||
| 93750ca9a2 | |||
| 34c81e7e93 | |||
| 9a9dfa63f1 | |||
| d01eb06cfb | |||
| 9e4e2c7ccb | |||
| bbe0a06a1e | |||
| ff693f7381 | |||
| 4c1e52ca88 | |||
| af4ded6872 | |||
| 81a87fa06d | |||
| 1514f1a366 | |||
| c5d8f86bc6 | |||
| db643d42c7 | |||
| c4feb7c040 | |||
| 900e0367dd | |||
| 82d36ffbf2 |
@@ -7,6 +7,7 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
370883CE19F08756000E79D6 /* CustomView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 370883CD19F08756000E79D6 /* CustomView.xib */; };
|
||||
5E0D045E1838AE0D00CBFC35 /* CWStatusBarNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0D045D1838AE0D00CBFC35 /* CWStatusBarNotification.m */; };
|
||||
5E2FFB5718367C01003333F8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E2FFB5618367C01003333F8 /* Foundation.framework */; };
|
||||
5E2FFB5918367C01003333F8 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E2FFB5818367C01003333F8 /* CoreGraphics.framework */; };
|
||||
@@ -34,6 +35,7 @@
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
370883CD19F08756000E79D6 /* CustomView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CustomView.xib; sourceTree = "<group>"; };
|
||||
5E0D045C1838AE0D00CBFC35 /* CWStatusBarNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CWStatusBarNotification.h; path = CWStatusBarNotification/CWStatusBarNotification.h; sourceTree = SOURCE_ROOT; };
|
||||
5E0D045D1838AE0D00CBFC35 /* CWStatusBarNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CWStatusBarNotification.m; path = CWStatusBarNotification/CWStatusBarNotification.m; sourceTree = SOURCE_ROOT; };
|
||||
5E2FFB5318367C01003333F8 /* CWNotificationDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CWNotificationDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -114,6 +116,7 @@
|
||||
children = (
|
||||
5E2FFB6518367C01003333F8 /* AppDelegate.h */,
|
||||
5E2FFB6618367C01003333F8 /* AppDelegate.m */,
|
||||
370883CD19F08756000E79D6 /* CustomView.xib */,
|
||||
5E2FFB8918367C75003333F8 /* View Controllers */,
|
||||
5E2FFB6818367C01003333F8 /* Images.xcassets */,
|
||||
5E2FFB5D18367C01003333F8 /* Supporting Files */,
|
||||
@@ -240,6 +243,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5E7E40DA19C0F9CF00A0E3E0 /* LaunchScreen.xib in Resources */,
|
||||
370883CE19F08756000E79D6 /* CustomView.xib in Resources */,
|
||||
5E2FFB6118367C01003333F8 /* InfoPlist.strings in Resources */,
|
||||
5E2FFB8F18367CA3003333F8 /* MainViewController.xib in Resources */,
|
||||
5E2FFB6918367C01003333F8 /* Images.xcassets in Resources */,
|
||||
@@ -307,6 +311,7 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
@@ -346,6 +351,7 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0830"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "5E2FFB5218367C01003333F8"
|
||||
BuildableName = "CWNotificationDemo.app"
|
||||
BlueprintName = "CWNotificationDemo"
|
||||
ReferencedContainer = "container:CWNotificationDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "5E2FFB6D18367C01003333F8"
|
||||
BuildableName = "CWNotificationDemoTests.xctest"
|
||||
BlueprintName = "CWNotificationDemoTests"
|
||||
ReferencedContainer = "container:CWNotificationDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "5E2FFB5218367C01003333F8"
|
||||
BuildableName = "CWNotificationDemo.app"
|
||||
BlueprintName = "CWNotificationDemo"
|
||||
ReferencedContainer = "container:CWNotificationDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "5E2FFB5218367C01003333F8"
|
||||
BuildableName = "CWNotificationDemo.app"
|
||||
BlueprintName = "CWNotificationDemo"
|
||||
ReferencedContainer = "container:CWNotificationDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "5E2FFB5218367C01003333F8"
|
||||
BuildableName = "CWNotificationDemo.app"
|
||||
BlueprintName = "CWNotificationDemo"
|
||||
ReferencedContainer = "container:CWNotificationDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" animating="YES" style="white" translatesAutoresizingMaskIntoConstraints="NO" id="r93-cW-Ts4">
|
||||
<rect key="frame" x="10" y="291" width="20" height="20"/>
|
||||
</activityIndicatorView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="This is a custom view" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z9l-SY-8er">
|
||||
<rect key="frame" x="218" y="290" width="165" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.098039224743843079" green="0.58039218187332153" blue="0.9803922176361084" alpha="1" colorSpace="deviceRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="centerX" secondItem="z9l-SY-8er" secondAttribute="centerX" id="64P-Uw-ajT"/>
|
||||
<constraint firstItem="r93-cW-Ts4" firstAttribute="centerY" secondItem="z9l-SY-8er" secondAttribute="centerY" id="Qc1-1z-FyY"/>
|
||||
<constraint firstItem="r93-cW-Ts4" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="10" id="R3u-Kd-l55"/>
|
||||
<constraint firstAttribute="centerY" secondItem="z9l-SY-8er" secondAttribute="centerY" id="pzf-Hi-YQD"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -15,6 +15,11 @@
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6245" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14A388a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<deployment defaultVersion="2048" identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
|
||||
@@ -16,10 +16,12 @@
|
||||
@property (weak, nonatomic) IBOutlet UITextField *txtNotificationMessage;
|
||||
@property (weak, nonatomic) IBOutlet UISegmentedControl *segFromStyle;
|
||||
@property (weak, nonatomic) IBOutlet UISegmentedControl *segToStyle;
|
||||
@property (weak, nonatomic) IBOutlet UISegmentedControl *notificationStyle;
|
||||
|
||||
@property (strong, nonatomic) CWStatusBarNotification *notification;
|
||||
|
||||
- (IBAction)sliderDurationChanged:(UISlider *)sender;
|
||||
- (IBAction)btnShowNotificationPressed:(UIButton *)sender;
|
||||
- (IBAction)btnShowCustomNotificationPressed:(UIButton *)sender;
|
||||
|
||||
@end
|
||||
|
||||
@@ -62,11 +62,24 @@
|
||||
|
||||
# pragma mark - show notification
|
||||
|
||||
- (IBAction)btnShowNotificationPressed:(UIButton *)sender
|
||||
- (void)setupNotification
|
||||
{
|
||||
self.notification.notificationAnimationInStyle = self.segFromStyle.selectedSegmentIndex;
|
||||
self.notification.notificationAnimationOutStyle = self.segToStyle.selectedSegmentIndex;
|
||||
self.notification.notificationStyle = self.notificationStyle.selectedSegmentIndex == 0 ?
|
||||
CWNotificationStyleStatusBarNotification : CWNotificationStyleNavigationBarNotification;
|
||||
}
|
||||
|
||||
- (IBAction)btnShowNotificationPressed:(UIButton *)sender
|
||||
{
|
||||
[self setupNotification];
|
||||
[self.notification displayNotificationWithMessage:self.txtNotificationMessage.text forDuration:self.sliderDuration.value];
|
||||
}
|
||||
|
||||
- (IBAction)btnShowCustomNotificationPressed:(UIButton *)sender {
|
||||
[self setupNotification];
|
||||
UIView *view = [[NSBundle mainBundle] loadNibNamed:@"CustomView" owner:nil options:nil][0];
|
||||
[self.notification displayNotificationWithView:view forDuration:self.sliderDuration.value];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6245" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14A388a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
|
||||
<capability name="Alignment constraints to the first baseline" minToolsVersion="6.0"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MainViewController">
|
||||
<connections>
|
||||
<outlet property="lblDuration" destination="oAK-DR-B27" id="roa-nx-2td"/>
|
||||
<outlet property="notificationStyle" destination="fcn-wc-llO" id="6cr-5b-6JN"/>
|
||||
<outlet property="segFromStyle" destination="vWx-wx-d32" id="Zvu-PE-8D7"/>
|
||||
<outlet property="segToStyle" destination="Bza-7R-910" id="CkD-Lr-RCl"/>
|
||||
<outlet property="sliderDuration" destination="lnj-T4-sfz" id="BYx-MN-Cnz"/>
|
||||
@@ -21,7 +21,7 @@
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DId-6z-9ak">
|
||||
<rect key="frame" x="147" y="257" width="121" height="30"/>
|
||||
<rect key="frame" x="147" y="293" width="121" height="30"/>
|
||||
<state key="normal" title="Show Notification">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
@@ -30,27 +30,23 @@
|
||||
</connections>
|
||||
</button>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="10" translatesAutoresizingMaskIntoConstraints="NO" id="lnj-T4-sfz">
|
||||
<rect key="frame" x="18" y="150" width="378" height="31"/>
|
||||
<rect key="frame" x="18" y="186" width="378" height="31"/>
|
||||
<connections>
|
||||
<action selector="sliderDurationChanged:" destination="-1" eventType="valueChanged" id="bHo-Bt-cG4"/>
|
||||
</connections>
|
||||
</slider>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Duration: " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nHX-St-Osi">
|
||||
<rect key="frame" x="20" y="189" width="75" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="M5r-vA-0qr"/>
|
||||
<constraint firstAttribute="width" constant="75" id="PQ4-ZU-uu9"/>
|
||||
</constraints>
|
||||
<rect key="frame" x="20" y="225" width="75" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oAK-DR-B27">
|
||||
<rect key="frame" x="103" y="189" width="291" height="21"/>
|
||||
<rect key="frame" x="103" y="225" width="291" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Notification Message" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="VqG-wR-oYI">
|
||||
<rect key="frame" x="20" y="217" width="374" height="30"/>
|
||||
<rect key="frame" x="20" y="253" width="374" height="30"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
@@ -72,29 +68,51 @@
|
||||
<segment title="From Right"/>
|
||||
</segments>
|
||||
</segmentedControl>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="fcn-wc-llO">
|
||||
<rect key="frame" x="20" y="150" width="374" height="29"/>
|
||||
<segments>
|
||||
<segment title="Status Bar"/>
|
||||
<segment title="Navigation Bar"/>
|
||||
</segments>
|
||||
</segmentedControl>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="E8G-aN-rjr">
|
||||
<rect key="frame" x="99" y="331" width="216" height="30"/>
|
||||
<state key="normal" title="Show Custom View Notification">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="btnShowCustomNotificationPressed:" destination="-1" eventType="touchUpInside" id="LIQ-4P-I0D"/>
|
||||
<action selector="btnShowNotificationPressed:" destination="-1" eventType="touchUpInside" id="jNW-Ie-NPn"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="lnj-T4-sfz" firstAttribute="leading" secondItem="nHX-St-Osi" secondAttribute="leading" id="7da-li-6Kn"/>
|
||||
<constraint firstItem="vWx-wx-d32" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="20" id="8hY-Bj-MI2"/>
|
||||
<constraint firstItem="oAK-DR-B27" firstAttribute="leading" secondItem="nHX-St-Osi" secondAttribute="trailing" constant="8" symbolic="YES" id="9ki-g4-vZj"/>
|
||||
<constraint firstItem="oAK-DR-B27" firstAttribute="trailing" secondItem="lnj-T4-sfz" secondAttribute="trailing" id="DF9-5s-ORR"/>
|
||||
<constraint firstItem="nHX-St-Osi" firstAttribute="firstBaseline" secondItem="oAK-DR-B27" secondAttribute="firstBaseline" id="ELp-HE-4nH"/>
|
||||
<constraint firstItem="VqG-wR-oYI" firstAttribute="top" secondItem="nHX-St-Osi" secondAttribute="bottom" constant="7" id="I7c-GM-lko"/>
|
||||
<constraint firstItem="vWx-wx-d32" firstAttribute="top" secondItem="1" secondAttribute="top" constant="78" id="UEb-Dv-gVI"/>
|
||||
<constraint firstItem="DId-6z-9ak" firstAttribute="centerX" secondItem="VqG-wR-oYI" secondAttribute="centerX" id="UR8-ES-cIh"/>
|
||||
<constraint firstItem="DId-6z-9ak" firstAttribute="top" secondItem="VqG-wR-oYI" secondAttribute="bottom" constant="10" id="ZgW-j6-ji5"/>
|
||||
<constraint firstItem="VqG-wR-oYI" firstAttribute="trailing" secondItem="oAK-DR-B27" secondAttribute="trailing" id="ca3-UN-5wh"/>
|
||||
<constraint firstItem="vWx-wx-d32" firstAttribute="trailing" secondItem="Bza-7R-910" secondAttribute="trailing" id="exg-le-qML"/>
|
||||
<constraint firstItem="Bza-7R-910" firstAttribute="leading" secondItem="vWx-wx-d32" secondAttribute="leading" id="iGR-gp-5UT"/>
|
||||
<constraint firstItem="lnj-T4-sfz" firstAttribute="top" secondItem="Bza-7R-910" secondAttribute="bottom" constant="8" symbolic="YES" id="iOO-Sk-CU0"/>
|
||||
<constraint firstItem="Bza-7R-910" firstAttribute="trailing" secondItem="lnj-T4-sfz" secondAttribute="trailing" id="pZ0-3h-ZuL"/>
|
||||
<constraint firstItem="VqG-wR-oYI" firstAttribute="leading" secondItem="nHX-St-Osi" secondAttribute="leading" id="qTt-Y1-xfG"/>
|
||||
<constraint firstItem="lnj-T4-sfz" firstAttribute="leading" secondItem="Bza-7R-910" secondAttribute="leading" id="tXW-Jb-JXr"/>
|
||||
<constraint firstItem="vWx-wx-d32" firstAttribute="centerX" secondItem="1" secondAttribute="centerX" id="ulj-gO-yBc"/>
|
||||
<constraint firstItem="nHX-St-Osi" firstAttribute="top" secondItem="lnj-T4-sfz" secondAttribute="bottom" constant="9" id="w3P-gu-lkL"/>
|
||||
<constraint firstItem="nHX-St-Osi" firstAttribute="baseline" secondItem="oAK-DR-B27" secondAttribute="baseline" id="xJd-gb-3E0"/>
|
||||
<constraint firstItem="Bza-7R-910" firstAttribute="top" secondItem="vWx-wx-d32" secondAttribute="bottom" constant="8" symbolic="YES" id="yyp-bu-hx4"/>
|
||||
<constraint firstItem="vWx-wx-d32" firstAttribute="top" secondItem="1" secondAttribute="top" constant="78" id="1oB-rT-mPo"/>
|
||||
<constraint firstAttribute="centerX" secondItem="fcn-wc-llO" secondAttribute="centerX" id="2Vh-Y9-bR5"/>
|
||||
<constraint firstItem="oAK-DR-B27" firstAttribute="top" secondItem="lnj-T4-sfz" secondAttribute="bottom" constant="9" id="6zC-Vn-47H"/>
|
||||
<constraint firstAttribute="centerX" secondItem="E8G-aN-rjr" secondAttribute="centerX" id="9d1-PR-JUW"/>
|
||||
<constraint firstItem="fcn-wc-llO" firstAttribute="top" secondItem="Bza-7R-910" secondAttribute="bottom" constant="8" id="CXZ-Xq-PaS"/>
|
||||
<constraint firstAttribute="centerX" secondItem="VqG-wR-oYI" secondAttribute="centerX" id="EZF-ae-sk0"/>
|
||||
<constraint firstItem="DId-6z-9ak" firstAttribute="top" secondItem="VqG-wR-oYI" secondAttribute="bottom" constant="10" id="Koz-Hg-zs6"/>
|
||||
<constraint firstItem="oAK-DR-B27" firstAttribute="leading" secondItem="nHX-St-Osi" secondAttribute="trailing" constant="8" id="Rv3-LK-x94"/>
|
||||
<constraint firstItem="vWx-wx-d32" firstAttribute="width" secondItem="Bza-7R-910" secondAttribute="width" id="TLh-rn-5OJ"/>
|
||||
<constraint firstItem="VqG-wR-oYI" firstAttribute="width" secondItem="fcn-wc-llO" secondAttribute="width" id="VN0-NS-cxS"/>
|
||||
<constraint firstItem="fcn-wc-llO" firstAttribute="width" secondItem="lnj-T4-sfz" secondAttribute="width" id="VaZ-W0-jE9"/>
|
||||
<constraint firstItem="nHX-St-Osi" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="20" id="am1-tr-889"/>
|
||||
<constraint firstItem="fcn-wc-llO" firstAttribute="width" secondItem="Bza-7R-910" secondAttribute="width" id="e4t-sE-dFP"/>
|
||||
<constraint firstAttribute="centerX" secondItem="DId-6z-9ak" secondAttribute="centerX" constant="-0.5" id="eaF-Ou-aly"/>
|
||||
<constraint firstAttribute="trailing" secondItem="vWx-wx-d32" secondAttribute="trailing" constant="20" id="fax-Hs-B09"/>
|
||||
<constraint firstItem="fcn-wc-llO" firstAttribute="width" secondItem="oAK-DR-B27" secondAttribute="width" constant="83" id="gJx-JQ-AKj"/>
|
||||
<constraint firstItem="Bza-7R-910" firstAttribute="top" secondItem="vWx-wx-d32" secondAttribute="bottom" constant="8" id="iKn-wI-ama"/>
|
||||
<constraint firstAttribute="centerX" secondItem="lnj-T4-sfz" secondAttribute="centerX" id="mud-VX-xYt"/>
|
||||
<constraint firstItem="nHX-St-Osi" firstAttribute="top" secondItem="lnj-T4-sfz" secondAttribute="bottom" constant="9" id="oWk-lv-8CY"/>
|
||||
<constraint firstItem="VqG-wR-oYI" firstAttribute="top" secondItem="nHX-St-Osi" secondAttribute="bottom" constant="7.5" id="pMI-GA-jIb"/>
|
||||
<constraint firstItem="vWx-wx-d32" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="20" id="qul-l9-Wcv"/>
|
||||
<constraint firstItem="lnj-T4-sfz" firstAttribute="top" secondItem="fcn-wc-llO" secondAttribute="bottom" constant="8" id="rcX-0a-RzU"/>
|
||||
<constraint firstAttribute="centerX" secondItem="Bza-7R-910" secondAttribute="centerX" id="wU3-cB-7dO"/>
|
||||
<constraint firstItem="E8G-aN-rjr" firstAttribute="top" secondItem="DId-6z-9ak" secondAttribute="bottom" constant="8" id="xGQ-39-pOh"/>
|
||||
<constraint firstAttribute="centerX" secondItem="vWx-wx-d32" secondAttribute="centerX" id="z6v-r5-zad"/>
|
||||
</constraints>
|
||||
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "CWStatusBarNotification"
|
||||
s.version = "2.1.3"
|
||||
s.version = "2.3.5"
|
||||
s.summary = "A library that creates status bar notifications."
|
||||
s.description = "CWStatusBarNotification is a library allows you to present a beautiful text-based notification in the status bar."
|
||||
s.homepage = "https://github.com/cezarywojcik/CWStatusBarNotification"
|
||||
|
||||
@@ -0,0 +1,311 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
73F0115B1F31AF2900EDC602 /* CWStatusBarNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 73F011591F31AF2900EDC602 /* CWStatusBarNotification.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
73F0115C1F31AF2900EDC602 /* CWStatusBarNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 73F0115A1F31AF2900EDC602 /* CWStatusBarNotification.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
73F0114C1F31AE9F00EDC602 /* CWStatusBarNotification.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CWStatusBarNotification.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
73F011571F31AF1B00EDC602 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
73F011591F31AF2900EDC602 /* CWStatusBarNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CWStatusBarNotification.h; path = CWStatusBarNotification/CWStatusBarNotification.h; sourceTree = "<group>"; };
|
||||
73F0115A1F31AF2900EDC602 /* CWStatusBarNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CWStatusBarNotification.m; path = CWStatusBarNotification/CWStatusBarNotification.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
73F011481F31AE9F00EDC602 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
73F011421F31AE9F00EDC602 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
73F011591F31AF2900EDC602 /* CWStatusBarNotification.h */,
|
||||
73F0115A1F31AF2900EDC602 /* CWStatusBarNotification.m */,
|
||||
73F011571F31AF1B00EDC602 /* Info.plist */,
|
||||
73F0114D1F31AE9F00EDC602 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
73F0114D1F31AE9F00EDC602 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
73F0114C1F31AE9F00EDC602 /* CWStatusBarNotification.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
73F011491F31AE9F00EDC602 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
73F0115B1F31AF2900EDC602 /* CWStatusBarNotification.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
73F0114B1F31AE9F00EDC602 /* CWStatusBarNotification */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 73F011541F31AE9F00EDC602 /* Build configuration list for PBXNativeTarget "CWStatusBarNotification" */;
|
||||
buildPhases = (
|
||||
73F011471F31AE9F00EDC602 /* Sources */,
|
||||
73F011481F31AE9F00EDC602 /* Frameworks */,
|
||||
73F011491F31AE9F00EDC602 /* Headers */,
|
||||
73F0114A1F31AE9F00EDC602 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = CWStatusBarNotification;
|
||||
productName = CWStatusBarNotification;
|
||||
productReference = 73F0114C1F31AE9F00EDC602 /* CWStatusBarNotification.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
73F011431F31AE9F00EDC602 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0900;
|
||||
ORGANIZATIONNAME = cezarywojcik;
|
||||
TargetAttributes = {
|
||||
73F0114B1F31AE9F00EDC602 = {
|
||||
CreatedOnToolsVersion = 8.3.3;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 73F011461F31AE9F00EDC602 /* Build configuration list for PBXProject "CWStatusBarNotification" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 73F011421F31AE9F00EDC602;
|
||||
productRefGroup = 73F0114D1F31AE9F00EDC602 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
73F0114B1F31AE9F00EDC602 /* CWStatusBarNotification */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
73F0114A1F31AE9F00EDC602 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
73F011471F31AE9F00EDC602 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
73F0115C1F31AF2900EDC602 /* CWStatusBarNotification.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
73F011521F31AE9F00EDC602 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
73F011531F31AE9F00EDC602 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
73F011551F31AE9F00EDC602 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cezarywojcik.CWStatusBarNotification;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
73F011561F31AE9F00EDC602 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cezarywojcik.CWStatusBarNotification;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
73F011461F31AE9F00EDC602 /* Build configuration list for PBXProject "CWStatusBarNotification" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
73F011521F31AE9F00EDC602 /* Debug */,
|
||||
73F011531F31AE9F00EDC602 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
73F011541F31AE9F00EDC602 /* Build configuration list for PBXNativeTarget "CWStatusBarNotification" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
73F011551F31AE9F00EDC602 /* Debug */,
|
||||
73F011561F31AE9F00EDC602 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 73F011431F31AE9F00EDC602 /* Project object */;
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "73F0114B1F31AE9F00EDC602"
|
||||
BuildableName = "CWStatusBarNotification.framework"
|
||||
BlueprintName = "CWStatusBarNotification"
|
||||
ReferencedContainer = "container:CWStatusBarNotification.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "73F0114B1F31AE9F00EDC602"
|
||||
BuildableName = "CWStatusBarNotification.framework"
|
||||
BlueprintName = "CWStatusBarNotification"
|
||||
ReferencedContainer = "container:CWStatusBarNotification.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "73F0114B1F31AE9F00EDC602"
|
||||
BuildableName = "CWStatusBarNotification.framework"
|
||||
BlueprintName = "CWStatusBarNotification"
|
||||
ReferencedContainer = "container:CWStatusBarNotification.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,62 +1,279 @@
|
||||
//
|
||||
// CWStatusBarNotification
|
||||
// CWNotificationDemo
|
||||
//
|
||||
// Created by Cezary Wojcik on 11/15/13.
|
||||
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
|
||||
// Copyright (c) 2015 Cezary Wojcik. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
/**
|
||||
* @brief A simple completion used for handling tapping the notification.
|
||||
*/
|
||||
typedef void(^CWCompletionBlock)(void);
|
||||
|
||||
# pragma mark - ScrollLabel
|
||||
|
||||
/**
|
||||
* A subclass of @c UILabel that scrolls the text if it is too long for the
|
||||
* label.
|
||||
*/
|
||||
@interface ScrollLabel : UILabel
|
||||
|
||||
@property (assign, nonatomic) UIEdgeInsets edgeInsets;
|
||||
|
||||
/**
|
||||
* Used to find the amount of time that the label will spend scrolling.
|
||||
* @return The amount of time that will be spent scrolling.
|
||||
*/
|
||||
- (CGFloat)scrollTime;
|
||||
@end
|
||||
|
||||
# pragma mark - CWWindowContainer
|
||||
|
||||
/**
|
||||
* A subclass of @c UIWindow that overrides the @c hitTest method in order to
|
||||
* allow tap events to pass through the window.
|
||||
*/
|
||||
@interface CWWindowContainer : UIWindow
|
||||
/// The height of the notification that is being displayed in the window.
|
||||
@property (assign, nonatomic) CGFloat notificationHeight;
|
||||
@end
|
||||
|
||||
# pragma mark - CWViewController
|
||||
|
||||
/**
|
||||
* A subclass of @c UIViewController that allows handing over
|
||||
* @c supportedInterfaceOrientations if needed.
|
||||
*/
|
||||
@interface CWViewController : UIViewController
|
||||
/// Indicates the preferred status bar style.
|
||||
@property (nonatomic) UIStatusBarStyle preferredStatusBarStyle;
|
||||
/// Indicats the supported interface orientations.
|
||||
@property (nonatomic, setter=setSupportedInterfaceOrientations:)
|
||||
UIInterfaceOrientationMask supportedInterfaceOrientations;
|
||||
@end
|
||||
|
||||
# pragma mark - CWStatusBarNotification
|
||||
|
||||
/**
|
||||
* A subclass of @c NSObject that is responsible for managing status bar
|
||||
* notifications.
|
||||
*/
|
||||
@interface CWStatusBarNotification : NSObject
|
||||
|
||||
# pragma mark - enums
|
||||
|
||||
/**
|
||||
* @typedef CWNotificationStyle
|
||||
* @brief Determines the notification style.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, CWNotificationStyle) {
|
||||
/// Covers the status bar portion of the screen.
|
||||
CWNotificationStyleStatusBarNotification,
|
||||
CWNotificationStyleNavigationBarNotification
|
||||
/// Covers the status bar and navigation bar portions of the screen.
|
||||
CWNotificationStyleNavigationBarNotification,
|
||||
/// For iPhone X Model
|
||||
CWNotificationStyleHomeIndicatorNotification
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef CWNotificationAnimationStyle
|
||||
* @brief Determines the direction of animation for the notification.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, CWNotificationAnimationStyle) {
|
||||
/// Animate in from the top or animate out to the top.
|
||||
CWNotificationAnimationStyleTop,
|
||||
/// Animate in from the bottom or animate out to the bottom.
|
||||
CWNotificationAnimationStyleBottom,
|
||||
/// Animate in from the left or animate out to the left.
|
||||
CWNotificationAnimationStyleLeft,
|
||||
/// Animate in from the right or animate out to the right.
|
||||
CWNotificationAnimationStyleRight
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef CWNotificationAnimationType
|
||||
* @brief Determines whether the notification moves the existing content out of
|
||||
* the way or simply overlays it.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, CWNotificationAnimationType) {
|
||||
/// Moves existing content out of the way.
|
||||
CWNotificationAnimationTypeReplace,
|
||||
/// Overlays existing content.
|
||||
CWNotificationAnimationTypeOverlay
|
||||
};
|
||||
|
||||
# pragma mark - properties
|
||||
|
||||
/// The label that holds the notification text.
|
||||
@property (strong, nonatomic) ScrollLabel *notificationLabel;
|
||||
@property (strong, nonatomic) UIColor *notificationLabelBackgroundColor;
|
||||
@property (strong, nonatomic) UIColor *notificationLabelTextColor;
|
||||
@property (assign, nonatomic) CGFloat notificationLabelHeight;
|
||||
@property (assign, nonatomic) BOOL multiline;
|
||||
|
||||
/// The @c UIView that holds a screenshot of the status bar view.
|
||||
@property (strong, nonatomic) UIView *statusBarView;
|
||||
|
||||
/// The block that gets triggered when the notification is tapped.
|
||||
@property (copy, nonatomic) CWCompletionBlock notificationTappedBlock;
|
||||
|
||||
@property (nonatomic) CWNotificationAnimationStyle notificationStyle;
|
||||
@property (nonatomic) CWNotificationAnimationStyle notificationAnimationInStyle;
|
||||
@property (nonatomic) CWNotificationAnimationStyle notificationAnimationOutStyle;
|
||||
@property (nonatomic) CWNotificationAnimationType notificationAnimationType;
|
||||
/// Indicates whether the notification is currently being shown.
|
||||
@property (nonatomic) BOOL notificationIsShowing;
|
||||
/// Indicates whether the notification is currently dismissing.
|
||||
@property (nonatomic) BOOL notificationIsDismissing;
|
||||
|
||||
/// The window that holds the notification.
|
||||
@property (strong, nonatomic) CWWindowContainer *notificationWindow;
|
||||
|
||||
- (void)displayNotificationWithMessage:(NSString *)message forDuration:(CGFloat)duration;
|
||||
- (void)displayNotificationWithMessage:(NSString *)message completion:(void (^)(void))completion;
|
||||
/**
|
||||
* The background color of the notification label. Default value is the tint
|
||||
* color of the application's main window.
|
||||
*/
|
||||
@property (strong, nonatomic) UIColor *notificationLabelBackgroundColor;
|
||||
/**
|
||||
* The text color of the notification label. Default value is white.
|
||||
*/
|
||||
@property (strong, nonatomic) UIColor *notificationLabelTextColor;
|
||||
/**
|
||||
* The font of the notification label. Default value is system font.
|
||||
*/
|
||||
@property (strong, nonatomic) UIFont *notificationLabelFont;
|
||||
/**
|
||||
* Allows setting a custom height for the notification label. If this value is
|
||||
* 0, the height will be determined by the @c notificationStyle. Default value
|
||||
* is 0.
|
||||
*/
|
||||
@property (assign, nonatomic) CGFloat notificationLabelHeight;
|
||||
/**
|
||||
* The custom view to present if using @c displayNotificationWithView. Default
|
||||
* value is @c nil.
|
||||
*/
|
||||
@property (strong, nonatomic) UIView *customView;
|
||||
/**
|
||||
* Determines whether the notification text has multiple lines. Default value is
|
||||
* @c NO.
|
||||
*/
|
||||
@property (assign, nonatomic) BOOL multiline;
|
||||
/**
|
||||
* The supported interface orientations. Default value is the
|
||||
* @c supportedInterfaceOrientations value of the root view controller of the
|
||||
* application.
|
||||
*/
|
||||
@property (nonatomic) UIInterfaceOrientationMask supportedInterfaceOrientations;
|
||||
/**
|
||||
* The amount of time that it takes to animate the notification in or out.
|
||||
* Default value is 0.25.
|
||||
*/
|
||||
@property (nonatomic) NSTimeInterval notificationAnimationDuration;
|
||||
/**
|
||||
* Determines whether the notification covers the status bar or both the status
|
||||
* bar and the navigation bar. Default value is
|
||||
* @c CWNotificationStyleStatusBarNotification.
|
||||
*/
|
||||
@property (nonatomic) CWNotificationStyle notificationStyle;
|
||||
/**
|
||||
* Determines the direction from which the notification animates in. Default
|
||||
* value is @c CWNotificationAnimationStyleBottom.
|
||||
*/
|
||||
@property (nonatomic) CWNotificationAnimationStyle notificationAnimationInStyle;
|
||||
/**
|
||||
* Determines the direction from which the notification animates out. Default
|
||||
* value is @c CWNotificationAnimationStyleBottom.
|
||||
*/
|
||||
@property (nonatomic) CWNotificationAnimationStyle
|
||||
notificationAnimationOutStyle;
|
||||
/**
|
||||
* Determines whether the the notification's animation replaces the existing
|
||||
* content or overlays it. Default value is
|
||||
* @c CWNotificationAnimationTypeReplace.
|
||||
*/
|
||||
@property (nonatomic) CWNotificationAnimationType notificationAnimationType;
|
||||
/**
|
||||
* The preferred status bar style. Default value is @c UIStatusBarStyleDefault.
|
||||
*/
|
||||
@property (nonatomic) UIStatusBarStyle preferredStatusBarStyle;
|
||||
|
||||
#pragma mark - methods
|
||||
|
||||
/**
|
||||
* Displays a notification with the indicated message and then performs the
|
||||
* completion block once the notification animates in.
|
||||
* @param message
|
||||
* The content of the message to be displayed.
|
||||
* @param completion
|
||||
* The block to be invoked once the notification is displayed.
|
||||
*/
|
||||
- (void)displayNotificationWithMessage:(NSString *)message
|
||||
completion:(void (^)(void))completion;
|
||||
|
||||
/**
|
||||
* Displays a notification with the indicated message for the indicated
|
||||
* duration.
|
||||
* @param message
|
||||
* The content of the message to be displayed.
|
||||
* @param duration
|
||||
* The amount of seconds for which the notification should be displayed,
|
||||
* not including the animate in and out times.
|
||||
*/
|
||||
- (void)displayNotificationWithMessage:(NSString *)message
|
||||
forDuration:(NSTimeInterval)duration;
|
||||
|
||||
/**
|
||||
* Displays a notification with the indicated attributed string and then
|
||||
* performs the completion block once the notification animates in.
|
||||
* @param attributedString
|
||||
* The content of the message to be displayed.
|
||||
* @param completion
|
||||
* The block to be invoked once the notification is displayed.
|
||||
*/
|
||||
- (void)displayNotificationWithAttributedString:(NSAttributedString *)
|
||||
attributedString
|
||||
completion:(void (^)(void))completion;
|
||||
|
||||
/**
|
||||
* Displays a notification with the indicated message for the indicated
|
||||
* duration.
|
||||
* @param attributedString
|
||||
* The content of the message to be displayed.
|
||||
* @param duration
|
||||
* The amount of seconds for which the notification should be displayed,
|
||||
* not including the animate in and out times.
|
||||
*/
|
||||
- (void)displayNotificationWithAttributedString:(NSAttributedString *)
|
||||
attributedString
|
||||
forDuration:(NSTimeInterval)duration;
|
||||
|
||||
/**
|
||||
* Displays a notification with the indicated custom view and then performs the
|
||||
* completion block once the notification animates in.
|
||||
* @param view
|
||||
* The custom @c UIView that you wish to present.
|
||||
* @param completion
|
||||
* The block to be invoked once the notification is displayed.
|
||||
*/
|
||||
|
||||
- (void)displayNotificationWithView:(UIView *)view
|
||||
completion:(void (^)(void))completion;
|
||||
|
||||
/**
|
||||
* Displays a notification with the indicated custom view for the indicated
|
||||
* duration.
|
||||
* @param view
|
||||
* The custom @c UIView that you wish to present.
|
||||
* @param duration
|
||||
* The amount of seconds for which the notification should be displayed,
|
||||
* not including the animate in and out times.
|
||||
*/
|
||||
- (void)displayNotificationWithView:(UIView *)view
|
||||
forDuration:(NSTimeInterval)duration;
|
||||
|
||||
/**
|
||||
* Dismisses the currently presented notification and then performs the
|
||||
* completion block.
|
||||
* @param completion
|
||||
* The block to be invoked after the notification is dismissed.
|
||||
*/
|
||||
- (void)dismissNotificationWithCompletion:(void(^)(void))completion;
|
||||
|
||||
/**
|
||||
* Dismisses the currently presented notification.
|
||||
*/
|
||||
|
||||
- (void)dismissNotification;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// CWNotificationDemo
|
||||
//
|
||||
// Created by Cezary Wojcik on 11/15/13.
|
||||
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
|
||||
// Copyright (c) 2015 Cezary Wojcik. All rights reserved.
|
||||
//
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
@@ -11,75 +11,13 @@
|
||||
|
||||
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
|
||||
|
||||
#define STATUS_BAR_ANIMATION_LENGTH 0.25f
|
||||
#define FONT_SIZE 12.0f
|
||||
#define PADDING 10.0f
|
||||
#define SCROLL_SPEED 40.0f
|
||||
#define SCROLL_DELAY 1.0f
|
||||
|
||||
@implementation CWWindowContainer
|
||||
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
||||
{
|
||||
CGFloat height;
|
||||
if (SYSTEM_VERSION_LESS_THAN(@"8.0") && UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
|
||||
height = [UIApplication sharedApplication].statusBarFrame.size.width;
|
||||
}
|
||||
else {
|
||||
height = [UIApplication sharedApplication].statusBarFrame.size.height;
|
||||
}
|
||||
|
||||
if (point.y > 0 && point.y < height) {
|
||||
return [super hitTest:point withEvent:event];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
# pragma mark - dispatch after with cancellation
|
||||
// adapted from: https://github.com/Spaceman-Labs/Dispatch-Cancel
|
||||
|
||||
typedef void(^CWDelayedBlockHandle)(BOOL cancel);
|
||||
|
||||
static CWDelayedBlockHandle perform_block_after_delay(CGFloat seconds, dispatch_block_t block)
|
||||
{
|
||||
if (block == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
__block dispatch_block_t blockToExecute = [block copy];
|
||||
__block CWDelayedBlockHandle delayHandleCopy = nil;
|
||||
|
||||
CWDelayedBlockHandle delayHandle = ^(BOOL cancel){
|
||||
if (NO == cancel && nil != blockToExecute) {
|
||||
dispatch_async(dispatch_get_main_queue(), blockToExecute);
|
||||
}
|
||||
|
||||
blockToExecute = nil;
|
||||
delayHandleCopy = nil;
|
||||
};
|
||||
|
||||
delayHandleCopy = [delayHandle copy];
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, seconds * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||
if (nil != delayHandleCopy) {
|
||||
delayHandleCopy(NO);
|
||||
}
|
||||
});
|
||||
|
||||
return delayHandleCopy;
|
||||
};
|
||||
|
||||
static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
{
|
||||
if (delayedHandle == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
delayedHandle(YES);
|
||||
}
|
||||
#define HOMEINDICATOR_OFFSET 11.0f
|
||||
#define HOMEINDICATOR_TEXT_INSET_BOTTOM 14.0f
|
||||
|
||||
# pragma mark - ScrollLabel
|
||||
|
||||
@@ -106,7 +44,7 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
- (CGFloat)scrollOffset
|
||||
{
|
||||
if (self.numberOfLines != 1) return 0;
|
||||
|
||||
|
||||
CGRect insetRect = CGRectInset(self.bounds, PADDING, 0);
|
||||
return MAX(0, [self fullWidth] - insetRect.size.width);
|
||||
}
|
||||
@@ -121,7 +59,7 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
if ([self scrollOffset] > 0) {
|
||||
rect.size.width = [self fullWidth] + PADDING * 2;
|
||||
UIGraphicsBeginImageContextWithOptions(rect.size, NO, [UIScreen mainScreen].scale);
|
||||
[super drawTextInRect:rect];
|
||||
[super drawTextInRect:UIEdgeInsetsInsetRect(rect, self.edgeInsets)];
|
||||
textImage.image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
[textImage sizeToFit];
|
||||
@@ -134,24 +72,123 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
}];
|
||||
} else {
|
||||
textImage.image = nil;
|
||||
[super drawTextInRect:CGRectInset(rect, PADDING, 0)];
|
||||
[super drawTextInRect:UIEdgeInsetsInsetRect(CGRectInset(rect, PADDING, 0), self.edgeInsets)];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
# pragma mark - CWWindowContainer
|
||||
|
||||
@implementation CWWindowContainer
|
||||
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
||||
{
|
||||
CGFloat height;
|
||||
if (SYSTEM_VERSION_LESS_THAN(@"8.0") && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
|
||||
height = [UIApplication sharedApplication].statusBarFrame.size.width;
|
||||
} else {
|
||||
height = [UIApplication sharedApplication].statusBarFrame.size.height;
|
||||
}
|
||||
if (point.y > 0 && point.y < (self.notificationHeight != 0.0 ? self.notificationHeight : height)) {
|
||||
return [super hitTest:point withEvent:event];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
# pragma mark - CWViewController
|
||||
|
||||
@interface CWViewController()
|
||||
|
||||
@property (nonatomic, assign) NSInteger _cwViewControllerSupportedInterfaceOrientation;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CWViewController
|
||||
|
||||
@synthesize preferredStatusBarStyle = _preferredStatusBarStyle;
|
||||
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||
{
|
||||
return _preferredStatusBarStyle;
|
||||
}
|
||||
|
||||
- (void)setSupportedInterfaceOrientations:(UIInterfaceOrientationMask)supportedInterfaceOrientations
|
||||
{
|
||||
self._cwViewControllerSupportedInterfaceOrientation = supportedInterfaceOrientations;
|
||||
}
|
||||
|
||||
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
|
||||
{
|
||||
return self._cwViewControllerSupportedInterfaceOrientation;
|
||||
}
|
||||
|
||||
- (BOOL)prefersStatusBarHidden
|
||||
{
|
||||
CGFloat statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
|
||||
return !(statusBarHeight > 0);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
# pragma mark - dispatch after with cancellation
|
||||
// adapted from: https://github.com/Spaceman-Labs/Dispatch-Cancel
|
||||
|
||||
typedef void(^CWDelayedBlockHandle)(BOOL cancel);
|
||||
|
||||
static CWDelayedBlockHandle perform_block_after_delay(CGFloat seconds, dispatch_block_t block)
|
||||
{
|
||||
if (block == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
__block dispatch_block_t blockToExecute = [block copy];
|
||||
__block CWDelayedBlockHandle delayHandleCopy = nil;
|
||||
|
||||
CWDelayedBlockHandle delayHandle = ^(BOOL cancel){
|
||||
if (NO == cancel && nil != blockToExecute) {
|
||||
dispatch_async(dispatch_get_main_queue(), blockToExecute);
|
||||
}
|
||||
|
||||
blockToExecute = nil;
|
||||
delayHandleCopy = nil;
|
||||
};
|
||||
|
||||
delayHandleCopy = [delayHandle copy];
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, seconds * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||
if (nil != delayHandleCopy) {
|
||||
delayHandleCopy(NO);
|
||||
}
|
||||
});
|
||||
|
||||
return delayHandleCopy;
|
||||
};
|
||||
|
||||
static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
{
|
||||
if (delayedHandle == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
delayedHandle(YES);
|
||||
}
|
||||
# pragma mark - CWStatusBarNotification
|
||||
|
||||
@interface CWStatusBarNotification()
|
||||
|
||||
@property (strong, nonatomic) UITapGestureRecognizer *tapGestureRecognizer;
|
||||
@property (strong, nonatomic) CWDelayedBlockHandle dismissHandle;
|
||||
@property (assign, nonatomic) BOOL isCustomView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CWStatusBarNotification
|
||||
|
||||
@synthesize notificationLabel, notificationLabelBackgroundColor, notificationLabelTextColor, notificationWindow;
|
||||
@synthesize notificationLabel, notificationLabelBackgroundColor, notificationLabelTextColor, notificationLabelFont, notificationWindow, customView;
|
||||
|
||||
@synthesize statusBarView;
|
||||
|
||||
@@ -161,19 +198,31 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
// set defaults
|
||||
self.notificationLabelBackgroundColor = [[UIApplication sharedApplication] delegate].window.tintColor;
|
||||
// set default
|
||||
if ([[[UIApplication sharedApplication] delegate] respondsToSelector:@selector(window)]) {
|
||||
self.notificationLabelBackgroundColor = [[UIApplication sharedApplication] delegate].window.tintColor;
|
||||
} else {
|
||||
self.notificationLabelBackgroundColor = [UIColor blackColor];
|
||||
}
|
||||
self.notificationLabelTextColor = [UIColor whiteColor];
|
||||
self.notificationLabelFont = [UIFont systemFontOfSize:FONT_SIZE];
|
||||
self.notificationLabelHeight = 0.0;
|
||||
self.customView = nil;
|
||||
self.multiline = NO;
|
||||
self.supportedInterfaceOrientations = [UIApplication sharedApplication].keyWindow.rootViewController.supportedInterfaceOrientations;
|
||||
self.notificationAnimationDuration = 0.25;
|
||||
self.notificationStyle = CWNotificationStyleStatusBarNotification;
|
||||
self.notificationAnimationInStyle = CWNotificationAnimationStyleBottom;
|
||||
self.notificationAnimationOutStyle = CWNotificationAnimationStyleBottom;
|
||||
self.notificationAnimationType = CWNotificationAnimationTypeReplace;
|
||||
self.notificationIsDismissing = NO;
|
||||
|
||||
self.isCustomView = NO;
|
||||
self.preferredStatusBarStyle = UIStatusBarStyleDefault;
|
||||
|
||||
// create tap recognizer
|
||||
self.tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(notificationTapped:)];
|
||||
self.tapGestureRecognizer.numberOfTapsRequired = 1;
|
||||
|
||||
|
||||
// create default tap block
|
||||
__weak typeof(self) weakSelf = self;
|
||||
self.notificationTappedBlock = ^(void) {
|
||||
@@ -192,8 +241,18 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
if (self.notificationLabelHeight > 0) {
|
||||
return self.notificationLabelHeight;
|
||||
}
|
||||
////
|
||||
|
||||
if (@available(iOS 11.0, *)) {
|
||||
if ([self notificationStyle]==CWNotificationStyleHomeIndicatorNotification) {
|
||||
return [[[UIApplication sharedApplication] keyWindow] safeAreaInsets].bottom;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CGFloat statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
|
||||
if (SYSTEM_VERSION_LESS_THAN(@"8.0") && UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
|
||||
if (SYSTEM_VERSION_LESS_THAN(@"8.0") && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
|
||||
statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.width;
|
||||
}
|
||||
return statusBarHeight > 0 ? statusBarHeight : 20;
|
||||
@@ -201,18 +260,54 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
|
||||
- (CGFloat)getStatusBarWidth
|
||||
{
|
||||
if (SYSTEM_VERSION_LESS_THAN(@"8.0") && UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
|
||||
if (SYSTEM_VERSION_LESS_THAN(@"8.0") && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
|
||||
return [UIScreen mainScreen].bounds.size.height;
|
||||
}
|
||||
return [UIScreen mainScreen].bounds.size.width;
|
||||
return [[UIApplication sharedApplication] keyWindow].bounds.size.width;
|
||||
}
|
||||
|
||||
- (CGFloat)getStatusBarOffset
|
||||
{
|
||||
CGFloat offset=0.0f;
|
||||
|
||||
if ([self getStatusBarHeight] == 40.0f) {
|
||||
return -20.0f;
|
||||
offset = -20.0f;
|
||||
}
|
||||
////
|
||||
|
||||
if (@available(iOS 11.0, *)) {
|
||||
if ([self notificationStyle]==CWNotificationStyleHomeIndicatorNotification) {
|
||||
UIWindow *keyWindow=[[UIApplication sharedApplication] keyWindow];
|
||||
offset=keyWindow.frame.size.height-[keyWindow safeAreaInsets].bottom-HOMEINDICATOR_OFFSET;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
- (CGFloat)getNavigationBarHeight
|
||||
{
|
||||
if (UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) ||
|
||||
UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
return 44.0f;
|
||||
}
|
||||
return 30.0f;
|
||||
}
|
||||
|
||||
- (CGFloat)getNotificationLabelHeight
|
||||
{
|
||||
switch (self.notificationStyle) {
|
||||
case CWNotificationStyleHomeIndicatorNotification:
|
||||
return [self getStatusBarHeight]+HOMEINDICATOR_OFFSET;
|
||||
case CWNotificationStyleStatusBarNotification:
|
||||
return [self getStatusBarHeight];
|
||||
case CWNotificationStyleNavigationBarNotification:
|
||||
return [self getStatusBarHeight] + [self getNavigationBarHeight];
|
||||
default:
|
||||
return [self getStatusBarHeight];
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
- (CGRect)getNotificationLabelTopFrame
|
||||
@@ -240,32 +335,12 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
return CGRectMake(0, [self getStatusBarOffset], [self getStatusBarWidth], [self getNotificationLabelHeight]);
|
||||
}
|
||||
|
||||
- (CGFloat)getNavigationBarHeight
|
||||
{
|
||||
if (UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) ||
|
||||
UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
return 44.0f;
|
||||
}
|
||||
return 30.0f;
|
||||
}
|
||||
|
||||
- (CGFloat)getNotificationLabelHeight
|
||||
{
|
||||
switch (self.notificationStyle) {
|
||||
case CWNotificationStyleStatusBarNotification:
|
||||
return [self getStatusBarHeight];
|
||||
case CWNotificationStyleNavigationBarNotification:
|
||||
return [self getStatusBarHeight] + [self getNavigationBarHeight];
|
||||
default:
|
||||
return [self getStatusBarHeight];
|
||||
}
|
||||
}
|
||||
|
||||
# pragma mark - screen orientation change
|
||||
|
||||
- (void)updateStatusBarFrame
|
||||
{
|
||||
self.notificationLabel.frame = [self getNotificationLabelFrame];
|
||||
UIView *view = self.isCustomView ? self.customView : self.notificationLabel;
|
||||
view.frame = [self getNotificationLabelFrame];
|
||||
self.statusBarView.hidden = YES;
|
||||
}
|
||||
|
||||
@@ -278,43 +353,75 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
|
||||
# pragma mark - display helpers
|
||||
|
||||
- (void)createNotificationLabelWithMessage:(NSString *)message
|
||||
- (void)setupNotificationView:(UIView *)view
|
||||
{
|
||||
self.notificationLabel = [ScrollLabel new];
|
||||
self.notificationLabel.numberOfLines = self.multiline ? 0 : 1;
|
||||
self.notificationLabel.text = message;
|
||||
self.notificationLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.notificationLabel.adjustsFontSizeToFitWidth = NO;
|
||||
self.notificationLabel.font = [UIFont systemFontOfSize:FONT_SIZE];
|
||||
self.notificationLabel.backgroundColor = self.notificationLabelBackgroundColor;
|
||||
self.notificationLabel.textColor = self.notificationLabelTextColor;
|
||||
self.notificationLabel.clipsToBounds = YES;
|
||||
self.notificationLabel.userInteractionEnabled = YES;
|
||||
[self.notificationLabel addGestureRecognizer:self.tapGestureRecognizer];
|
||||
view.clipsToBounds = YES;
|
||||
view.userInteractionEnabled = YES;
|
||||
[view addGestureRecognizer:self.tapGestureRecognizer];
|
||||
switch (self.notificationAnimationInStyle) {
|
||||
case CWNotificationAnimationStyleTop:
|
||||
self.notificationLabel.frame = [self getNotificationLabelTopFrame];
|
||||
view.frame = [self getNotificationLabelTopFrame];
|
||||
break;
|
||||
case CWNotificationAnimationStyleBottom:
|
||||
self.notificationLabel.frame = [self getNotificationLabelBottomFrame];
|
||||
view.frame = [self getNotificationLabelBottomFrame];
|
||||
break;
|
||||
case CWNotificationAnimationStyleLeft:
|
||||
self.notificationLabel.frame = [self getNotificationLabelLeftFrame];
|
||||
view.frame = [self getNotificationLabelLeftFrame];
|
||||
break;
|
||||
case CWNotificationAnimationStyleRight:
|
||||
self.notificationLabel.frame = [self getNotificationLabelRightFrame];
|
||||
view.frame = [self getNotificationLabelRightFrame];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)createNotificationLabelWithMessage:(NSString *)message
|
||||
{
|
||||
self.notificationLabel = [ScrollLabel new];
|
||||
|
||||
if ([self notificationStyle]==CWNotificationStyleHomeIndicatorNotification) {
|
||||
self.notificationLabel.edgeInsets=UIEdgeInsetsMake(0, 0, HOMEINDICATOR_TEXT_INSET_BOTTOM, 0);
|
||||
|
||||
}
|
||||
|
||||
self.notificationLabel.numberOfLines = self.multiline ? 0 : 1;
|
||||
self.notificationLabel.text = message;
|
||||
self.notificationLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.notificationLabel.adjustsFontSizeToFitWidth = NO;
|
||||
self.notificationLabel.font = self.notificationLabelFont;
|
||||
self.notificationLabel.backgroundColor = self.notificationLabelBackgroundColor;
|
||||
self.notificationLabel.textColor = self.notificationLabelTextColor;
|
||||
[self setupNotificationView:self.notificationLabel];
|
||||
}
|
||||
|
||||
- (void)createNotificationCustomView:(UIView *)view
|
||||
{
|
||||
self.customView = [[UIView alloc] init];
|
||||
// Doesn't use autoresizing masks so that we can create constraints below manually
|
||||
[view setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
[self.customView addSubview:view];
|
||||
|
||||
// Setup Auto Layout constaints so that the custom view that is added is consrtained to be the same
|
||||
// size as its superview, whose frame will be altered
|
||||
[self.customView addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.customView attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0]];
|
||||
[self.customView addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.customView attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0.0]];
|
||||
[self.customView addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.customView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0]];
|
||||
[self.customView addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.customView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]];
|
||||
|
||||
[self setupNotificationView:self.customView];
|
||||
}
|
||||
|
||||
- (void)createNotificationWindow
|
||||
{
|
||||
self.notificationWindow = [[CWWindowContainer alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
self.notificationWindow = [[CWWindowContainer alloc] initWithFrame:[[[UIApplication sharedApplication] keyWindow] bounds]];
|
||||
self.notificationWindow.backgroundColor = [UIColor clearColor];
|
||||
self.notificationWindow.userInteractionEnabled = YES;
|
||||
self.notificationWindow.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
self.notificationWindow.windowLevel = UIWindowLevelStatusBar;
|
||||
self.notificationWindow.rootViewController = [UIViewController new];
|
||||
CWViewController *rootViewController = [[CWViewController alloc] init];
|
||||
[rootViewController setSupportedInterfaceOrientations:self.supportedInterfaceOrientations];
|
||||
rootViewController.preferredStatusBarStyle = self.preferredStatusBarStyle;
|
||||
self.notificationWindow.rootViewController = rootViewController;
|
||||
self.notificationWindow.notificationHeight = [self getNotificationLabelHeight];
|
||||
}
|
||||
|
||||
- (void)createStatusBarView
|
||||
@@ -333,7 +440,8 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
|
||||
- (void)firstFrameChange
|
||||
{
|
||||
self.notificationLabel.frame = [self getNotificationLabelFrame];
|
||||
UIView *view = self.isCustomView ? self.customView : self.notificationLabel;
|
||||
view.frame = [self getNotificationLabelFrame];
|
||||
switch (self.notificationAnimationInStyle) {
|
||||
case CWNotificationAnimationStyleTop:
|
||||
self.statusBarView.frame = [self getNotificationLabelBottomFrame];
|
||||
@@ -352,14 +460,15 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
|
||||
- (void)secondFrameChange
|
||||
{
|
||||
UIView *view = self.isCustomView ? self.customView : self.notificationLabel;
|
||||
switch (self.notificationAnimationOutStyle) {
|
||||
case CWNotificationAnimationStyleTop:
|
||||
self.statusBarView.frame = [self getNotificationLabelBottomFrame];
|
||||
break;
|
||||
case CWNotificationAnimationStyleBottom:
|
||||
self.statusBarView.frame = [self getNotificationLabelTopFrame];
|
||||
self.notificationLabel.layer.anchorPoint = CGPointMake(0.5f, 1.0f);
|
||||
self.notificationLabel.center = CGPointMake(self.notificationLabel.center.x, [self getStatusBarOffset] + [self getNotificationLabelHeight]);
|
||||
view.layer.anchorPoint = CGPointMake(0.5f, 1.0f);
|
||||
view.center = CGPointMake(view.center.x, [self getStatusBarOffset] + [self getNotificationLabelHeight]);
|
||||
break;
|
||||
case CWNotificationAnimationStyleLeft:
|
||||
self.statusBarView.frame = [self getNotificationLabelRightFrame];
|
||||
@@ -372,19 +481,20 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
|
||||
- (void)thirdFrameChange
|
||||
{
|
||||
UIView *view = self.isCustomView ? self.customView : self.notificationLabel;
|
||||
self.statusBarView.frame = [self getNotificationLabelFrame];
|
||||
switch (self.notificationAnimationOutStyle) {
|
||||
case CWNotificationAnimationStyleTop:
|
||||
self.notificationLabel.frame = [self getNotificationLabelTopFrame];
|
||||
view.frame = [self getNotificationLabelTopFrame];
|
||||
break;
|
||||
case CWNotificationAnimationStyleBottom:
|
||||
self.notificationLabel.transform = CGAffineTransformMakeScale(1.0f, 0.01f);
|
||||
view.transform = CGAffineTransformMakeScale(1.0f, 0.01f);
|
||||
break;
|
||||
case CWNotificationAnimationStyleLeft:
|
||||
self.notificationLabel.frame = [self getNotificationLabelLeftFrame];
|
||||
view.frame = [self getNotificationLabelLeftFrame];
|
||||
break;
|
||||
case CWNotificationAnimationStyleRight:
|
||||
self.notificationLabel.frame = [self getNotificationLabelRightFrame];
|
||||
view.frame = [self getNotificationLabelRightFrame];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -394,30 +504,38 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
- (void)displayNotificationWithMessage:(NSString *)message completion:(void (^)(void))completion
|
||||
{
|
||||
if (!self.notificationIsShowing) {
|
||||
self.isCustomView = NO;
|
||||
self.notificationIsShowing = YES;
|
||||
|
||||
|
||||
// create UIWindow
|
||||
[self createNotificationWindow];
|
||||
|
||||
|
||||
// create ScrollLabel
|
||||
[self createNotificationLabelWithMessage:message];
|
||||
|
||||
|
||||
// create status bar view
|
||||
[self createStatusBarView];
|
||||
|
||||
if ([self notificationStyle]==CWNotificationStyleHomeIndicatorNotification) {
|
||||
[self.statusBarView removeFromSuperview];
|
||||
self.statusBarView=nil;
|
||||
|
||||
} else {
|
||||
[self createStatusBarView];
|
||||
|
||||
}
|
||||
|
||||
// add label to window
|
||||
[self.notificationWindow.rootViewController.view addSubview:self.notificationLabel];
|
||||
[self.notificationWindow.rootViewController.view bringSubviewToFront:self.notificationLabel];
|
||||
[self.notificationWindow setHidden:NO];
|
||||
|
||||
|
||||
// checking for screen orientation change
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateStatusBarFrame) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
|
||||
|
||||
// checking for status bar change
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateStatusBarFrame) name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
|
||||
|
||||
|
||||
// animate
|
||||
[UIView animateWithDuration:STATUS_BAR_ANIMATION_LENGTH animations:^{
|
||||
[UIView animateWithDuration:self.notificationAnimationDuration animations:^{
|
||||
[self firstFrameChange];
|
||||
} completion:^(BOOL finished) {
|
||||
double delayInSeconds = [self.notificationLabel scrollTime];
|
||||
@@ -428,29 +546,7 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dismissNotification
|
||||
{
|
||||
if (self.notificationIsShowing) {
|
||||
cancel_delayed_block(self.dismissHandle);
|
||||
self.notificationIsDismissing = YES;
|
||||
[self secondFrameChange];
|
||||
[UIView animateWithDuration:STATUS_BAR_ANIMATION_LENGTH animations:^{
|
||||
[self thirdFrameChange];
|
||||
} completion:^(BOOL finished) {
|
||||
[self.notificationLabel removeFromSuperview];
|
||||
[self.statusBarView removeFromSuperview];
|
||||
[self.notificationWindow setHidden:YES];
|
||||
self.notificationWindow = nil;
|
||||
self.notificationLabel = nil;
|
||||
self.notificationIsShowing = NO;
|
||||
self.notificationIsDismissing = NO;
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)displayNotificationWithMessage:(NSString *)message forDuration:(CGFloat)duration
|
||||
- (void)displayNotificationWithMessage:(NSString *)message forDuration:(NSTimeInterval)duration
|
||||
{
|
||||
[self displayNotificationWithMessage:message completion:^{
|
||||
self.dismissHandle = perform_block_after_delay(duration, ^{
|
||||
@@ -459,4 +555,102 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)displayNotificationWithAttributedString:(NSAttributedString *)attributedString completion:(void (^)(void))completion
|
||||
{
|
||||
[self displayNotificationWithMessage:[attributedString string] completion:completion];
|
||||
[[self notificationLabel] setAttributedText:attributedString];
|
||||
}
|
||||
|
||||
- (void)displayNotificationWithAttributedString:(NSAttributedString *)attributedString forDuration:(NSTimeInterval)duration
|
||||
{
|
||||
[self displayNotificationWithMessage:[attributedString string] forDuration:duration];
|
||||
[[self notificationLabel] setAttributedText:attributedString];
|
||||
}
|
||||
|
||||
- (void)displayNotificationWithView:(UIView *)view completion:(void (^)(void))completion
|
||||
{
|
||||
if (!self.notificationIsShowing) {
|
||||
self.isCustomView = YES;
|
||||
self.notificationIsShowing = YES;
|
||||
|
||||
// create window
|
||||
[self createNotificationWindow];
|
||||
|
||||
// setup view
|
||||
[self createNotificationCustomView:view];
|
||||
|
||||
// create status bar view
|
||||
if ([self notificationStyle]==CWNotificationStyleHomeIndicatorNotification) {
|
||||
[self.statusBarView removeFromSuperview];
|
||||
self.statusBarView=nil;
|
||||
|
||||
} else {
|
||||
[self createStatusBarView];
|
||||
|
||||
}
|
||||
|
||||
// add view to window
|
||||
UIView *rootView = self.notificationWindow.rootViewController.view;
|
||||
[rootView addSubview:self.customView];
|
||||
[rootView bringSubviewToFront:self.customView];
|
||||
[self.notificationWindow setHidden:NO];
|
||||
|
||||
// checking for screen orientation change
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateStatusBarFrame) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
|
||||
|
||||
// checking for status bar change
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateStatusBarFrame) name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
|
||||
|
||||
// animate
|
||||
[UIView animateWithDuration:self.notificationAnimationDuration animations:^{
|
||||
[self firstFrameChange];
|
||||
} completion:^(BOOL finished) {
|
||||
[completion invoke];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)displayNotificationWithView:(UIView *)view forDuration:(NSTimeInterval)duration
|
||||
{
|
||||
[self displayNotificationWithView:view completion:^{
|
||||
self.dismissHandle = perform_block_after_delay(duration, ^{
|
||||
[self dismissNotification];
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)dismissNotificationWithCompletion:(void (^)(void))completion
|
||||
{
|
||||
if (self.notificationIsShowing) {
|
||||
cancel_delayed_block(self.dismissHandle);
|
||||
self.notificationIsDismissing = YES;
|
||||
[self secondFrameChange];
|
||||
[UIView animateWithDuration:self.notificationAnimationDuration animations:^{
|
||||
[self thirdFrameChange];
|
||||
} completion:^(BOOL finished) {
|
||||
UIView *view = self.isCustomView ? self.customView : self.notificationLabel;
|
||||
[view removeFromSuperview];
|
||||
[self.statusBarView removeFromSuperview];
|
||||
[self.notificationWindow setHidden:YES];
|
||||
self.notificationWindow = nil;
|
||||
view = nil;
|
||||
self.notificationIsShowing = NO;
|
||||
self.notificationIsDismissing = NO;
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
|
||||
if (completion) {
|
||||
completion();
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
if (completion) {
|
||||
completion();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dismissNotification
|
||||
{
|
||||
[self dismissNotificationWithCompletion:nil];
|
||||
}
|
||||
@end
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Cezary Wojcik <http://www.cezarywojcik.com>
|
||||
Copyright (c) 2015 Cezary Wojcik <http://www.cezarywojcik.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
|
||||
[](https://travis-ci.org/cezarywojcik/CWStatusBarNotification)
|
||||
|
||||
**NOTE:** You can find a `Swift` implementation of this library [in the swift branch of this repo](https://github.com/cezarywojcik/CWStatusBarNotification/tree/swift).
|
||||
**NOTE:** You can find a **Swift 2.0** implementation of this library [in the swift branch of this repo](https://github.com/cezarywojcik/CWStatusBarNotification/tree/swift).
|
||||
|
||||
`CWStatusBarNotification` is a library that allows you to easily create text-based notifications that appear on the status bar.
|
||||
|
||||
You can find the documentation [here](http://cocoadocs.org/docsets/CWStatusBarNotification/).
|
||||
|
||||

|
||||
|
||||
## Requirements
|
||||
@@ -18,7 +20,7 @@ Works for iPhone and iPad.
|
||||
|
||||
### CocoaPods
|
||||
|
||||
`pod 'CWStatusBarNotification', '~> 2.1.3'`
|
||||
`pod 'CWStatusBarNotification', '~> 2.3.5'`
|
||||
|
||||
### Manual
|
||||
|
||||
@@ -26,29 +28,28 @@ Copy the folder `CWStatusBarNotification` to your project.
|
||||
|
||||
## Usage
|
||||
|
||||
***Note:** The previous version of this library implemented the notifications using a category. This version uses an object instead.*
|
||||
|
||||
Firstly, you need the following import statement:
|
||||
|
||||
```
|
||||
```objc
|
||||
#import "CWStatusBarNotification.h"
|
||||
```
|
||||
|
||||
Now, you need to create a `CWStatusBarNotification` object. It is recommended that you do so by attaching it as a property to a `UIViewController`.
|
||||
|
||||
```
|
||||
```objc
|
||||
CWStatusBarNotification *notification = [CWStatusBarNotification new];
|
||||
```
|
||||
|
||||
After you have a `CWStatusBarNotification` object, you can simply call the `displayNotificationMessage:forDuration:` method:
|
||||
|
||||
```
|
||||
```objc
|
||||
[self.notification displayNotificationWithMessage:@"Hello, World!"
|
||||
forDuration:1.0f];
|
||||
```
|
||||
|
||||
If you prefer to manually choose when to display and dismiss the notification, you can do so as well:
|
||||
|
||||
```
|
||||
```objc
|
||||
[self.notification displayNotificationWithMessage:@"Hello" completion:nil];
|
||||
// wait until you need to dismiss
|
||||
[self.notification dismissNotification];
|
||||
@@ -60,17 +61,16 @@ The default behavior when the notification is tapped is to dismiss it. However,
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
```objc
|
||||
self.notification.notificationTappedBlock = ^(void) {
|
||||
NSLog(@"notification tapped");
|
||||
// more code here
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
Note that overriding this block means that the notification will no longer be dismissed when tapped. If you want the notification to still dismiss when tapped, make sure to implement the following when overriding the block:
|
||||
|
||||
```
|
||||
```objc
|
||||
__weak typeof(self) weakSelf = self;
|
||||
self.notification.notificationTappedBlock = ^(void) {
|
||||
if (!weakSelf.notificationIsDismissing) {
|
||||
@@ -86,7 +86,7 @@ First of all, you can customize the background color and text color using the fo
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
```objc
|
||||
notification.notificationLabelBackgroundColor = [UIColor blackColor];
|
||||
notification.notificationLabelTextColor = [UIColor greenColor];
|
||||
```
|
||||
@@ -118,15 +118,42 @@ The default value for `notificationAnimationInStyle` is `CWNotificationAnimation
|
||||
|
||||
The default value for `notificationAnimationOutStyle` is `CWNotificationAnimationStyleTop`.
|
||||
|
||||
## Presenting a Custom View
|
||||
|
||||
As of version `2.2.0`, you can choose to present a custom view in lieu of presenting a simple message. The demo project shows a simple way in which you can make a custom NIB file and present it as the notification view using the `displayNotificationWithView:forDuration:` method:
|
||||
|
||||
```objc
|
||||
UIView *view = [[NSBundle mainBundle] loadNibNamed:@"CustomView" owner:nil options:nil][0];
|
||||
[self.notification displayNotificationWithView:view forDuration:self.sliderDuration.value];
|
||||
```
|
||||
|
||||
You can also display the notification and choose when to dismiss it as usual:
|
||||
|
||||
```objc
|
||||
[self.notification displayNotificationWithView:view completion:nil];
|
||||
// wait until you need to dismiss
|
||||
[self.notification dismissNotification];
|
||||
```
|
||||
|
||||
|
||||
### Additional Remarks
|
||||
|
||||
The notifications will work in both screen orientations, however, screen rotation while a notification is displayed is not yet fully supported.
|
||||
|
||||
## Apps Using This Library
|
||||
|
||||
If you would like for your app to be featured here, [contact me](http://cezarywojcik.com/contact) and I would love to hear about your app!
|
||||
|
||||
* [SlideShare Presentations](https://itunes.apple.com/app/id917418728)
|
||||
* [Pong Ping](https://itunes.apple.com/us/app/pong-ping-social-addictive/id822887888)
|
||||
* [NextMovies](https://itunes.apple.com/us/app/nextmovies-smart-movie-recommendation/id680850329)
|
||||
* [Social Dummy](https://itunes.apple.com/gb/app/social-dummy-create-fake-social/id610088272)
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Cezary Wojcik <http://www.cezarywojcik.com>
|
||||
Copyright (c) 2015 Cezary Wojcik <http://www.cezarywojcik.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1016 KiB After Width: | Height: | Size: 4.6 MiB |
Reference in New Issue
Block a user