Compare commits

..

29 Commits

Author SHA1 Message Date
Cezary Wojcik 3b27bd914b 2.1.2 2014-09-10 14:31:54 -07:00
Cezary Wojcik 234ebf1d4c Merge pull request #29 from DocuSignDev/feature/ios8-status-bar-size
Fix iOS 8 status bar width
2014-09-05 07:50:51 -05:00
Stephen Parish 8eda4da7c0 Add ios 7 compatibility to fix for ios 8 status bar widths 2014-09-05 00:47:45 -07:00
Stephen Parish 2a60603b7f enable ios 8 compatibility by being able to trust status bar dimensions
In iOS 8 status bar height and width are actually correct no matter the orientation now. Same for all UIWindows as well.

Fixes #28
2014-09-05 00:34:02 -07:00
Cezary Wojcik bd6b6522a8 Merge pull request #26 from ddwang/master
renamed CompletionBlock to CWCompletionBlock to prevent typedef conflicts
2014-07-30 22:08:43 -05:00
Daniel Wang 7b8fd4cc5c renamed CompletionBlock to CWCompletionBlock to prevent typedef conflicts 2014-07-30 14:26:50 -07:00
Cezary Wojcik 281d12eb46 in call status bar offset 2014-07-08 06:55:09 -05:00
Cezary Wojcik 7a05a62c16 added note about swift version to read me 2014-06-08 14:25:41 -07:00
Cezary Wojcik 8382cd9738 subclass UIWindow
thanks to @dzenbot for this fix
2014-05-28 09:46:32 -07:00
Cezary Wojcik 317b8e6db5 Merge pull request #22 from epologee/patch-1
Set the notification window to hidden
2014-05-16 11:46:40 -07:00
Eric-Paul Lecluse 8c68f3e2cd Set the notification window to hidden
By setting the hidden flag, the OS will poll the status bar style of the original view controller. Without this flag, the status bar will always become black after the notification animation.
2014-05-16 19:02:11 +02:00
Cezary Wojcik c8ba3fca9e added dismiss on tap with ability to override 2014-03-30 17:55:12 -07:00
Cezary Wojcik 194f00b40a updated readme with travis status image 2014-03-15 15:29:37 -07:00
Cezary Wojcik 2378a998fb travis 2014-03-15 15:21:37 -07:00
Cezary Wojcik 9704c4a593 2.1.1 2014-03-15 15:09:34 -07:00
Cezary Wojcik 2504969cdf fixed from bottom animation 2014-03-15 12:39:30 -07:00
Cezary Wojcik 34574e0309 Merge pull request #11 from mstrchrstphr/master
Update README.md
2014-02-17 17:50:04 -08:00
Christopher Constable 3a0e5081b4 Update README.md 2014-02-17 19:49:00 -05:00
Cezary Wojcik d68d5acaa0 Merge pull request #8 from dannybabiy/master
Allow for longer text, and appearance options for when you don't have a visible status bar.
2013-12-26 22:31:18 -08:00
Danny Babiy 04c750b19f allow for multiline 2013-12-26 21:57:19 -05:00
Danny Babiy 7169617a68 allow to set a custom label height 2013-12-26 14:22:05 -05:00
Danny Babiy e6cee95c7d allow for overlay type of animation 2013-12-26 14:19:53 -05:00
Danny Babiy 2431285d57 scroll long text 2013-12-26 12:40:30 -05:00
Cezary Wojcik d64336e03e cocoapod 2013-11-17 10:27:20 -08:00
Cezary Wojcik e2d2826e6c 2.1.0
added custom display/dismiss methods
2013-11-17 10:11:56 -08:00
Cezary Wojcik 8bd01ad27c Updated screenshot 2013-11-17 00:57:43 -08:00
Cezary Wojcik 2c9bc8677c Updated README and screenshots 2013-11-17 00:56:20 -08:00
Cezary Wojcik fa4d467094 2.0.0
Refactored to be object instead of category and added substantial new
animation features.
2013-11-17 00:26:04 -08:00
Cezary Wojcik 106872857a 1.1.0 2013-11-14 21:56:39 -08:00
38 changed files with 1407 additions and 1176 deletions
+1
View File
@@ -0,0 +1 @@
language: objective-c
@@ -0,0 +1,480 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
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 */; };
5E2FFB5B18367C01003333F8 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E2FFB5A18367C01003333F8 /* UIKit.framework */; };
5E2FFB6118367C01003333F8 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5E2FFB5F18367C01003333F8 /* InfoPlist.strings */; };
5E2FFB6318367C01003333F8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E2FFB6218367C01003333F8 /* main.m */; };
5E2FFB6718367C01003333F8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E2FFB6618367C01003333F8 /* AppDelegate.m */; };
5E2FFB6918367C01003333F8 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5E2FFB6818367C01003333F8 /* Images.xcassets */; };
5E2FFB7018367C01003333F8 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E2FFB6F18367C01003333F8 /* XCTest.framework */; };
5E2FFB7118367C01003333F8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E2FFB5618367C01003333F8 /* Foundation.framework */; };
5E2FFB7218367C01003333F8 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E2FFB5A18367C01003333F8 /* UIKit.framework */; };
5E2FFB8E18367CA3003333F8 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E2FFB8C18367CA3003333F8 /* MainViewController.m */; };
5E2FFB8F18367CA3003333F8 /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5E2FFB8D18367CA3003333F8 /* MainViewController.xib */; };
5E7E40DA19C0F9CF00A0E3E0 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5E7E40D919C0F9CF00A0E3E0 /* LaunchScreen.xib */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
5E2FFB7318367C01003333F8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 5E2FFB4B18367C01003333F8 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 5E2FFB5218367C01003333F8;
remoteInfo = CWNotificationDemo;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
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; };
5E2FFB5618367C01003333F8 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
5E2FFB5818367C01003333F8 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
5E2FFB5A18367C01003333F8 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
5E2FFB5E18367C01003333F8 /* CWNotificationDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CWNotificationDemo-Info.plist"; sourceTree = "<group>"; };
5E2FFB6018367C01003333F8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
5E2FFB6218367C01003333F8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
5E2FFB6418367C01003333F8 /* CWNotificationDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CWNotificationDemo-Prefix.pch"; sourceTree = "<group>"; };
5E2FFB6518367C01003333F8 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
5E2FFB6618367C01003333F8 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
5E2FFB6818367C01003333F8 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
5E2FFB6E18367C01003333F8 /* CWNotificationDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CWNotificationDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
5E2FFB6F18367C01003333F8 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
5E2FFB8B18367CA3003333F8 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = "<group>"; };
5E2FFB8C18367CA3003333F8 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = "<group>"; };
5E2FFB8D18367CA3003333F8 /* MainViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainViewController.xib; sourceTree = "<group>"; };
5E7E40D919C0F9CF00A0E3E0 /* LaunchScreen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LaunchScreen.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
5E2FFB5018367C01003333F8 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
5E2FFB5918367C01003333F8 /* CoreGraphics.framework in Frameworks */,
5E2FFB5B18367C01003333F8 /* UIKit.framework in Frameworks */,
5E2FFB5718367C01003333F8 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5E2FFB6B18367C01003333F8 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
5E2FFB7018367C01003333F8 /* XCTest.framework in Frameworks */,
5E2FFB7218367C01003333F8 /* UIKit.framework in Frameworks */,
5E2FFB7118367C01003333F8 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
5E2FFB4A18367C01003333F8 = {
isa = PBXGroup;
children = (
5E2FFB8518367C1B003333F8 /* CWStatusBarNotification */,
5E2FFB5C18367C01003333F8 /* CWNotificationDemo */,
5E2FFB5518367C01003333F8 /* Frameworks */,
5E2FFB5418367C01003333F8 /* Products */,
);
sourceTree = "<group>";
};
5E2FFB5418367C01003333F8 /* Products */ = {
isa = PBXGroup;
children = (
5E2FFB5318367C01003333F8 /* CWNotificationDemo.app */,
5E2FFB6E18367C01003333F8 /* CWNotificationDemoTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
5E2FFB5518367C01003333F8 /* Frameworks */ = {
isa = PBXGroup;
children = (
5E2FFB5618367C01003333F8 /* Foundation.framework */,
5E2FFB5818367C01003333F8 /* CoreGraphics.framework */,
5E2FFB5A18367C01003333F8 /* UIKit.framework */,
5E2FFB6F18367C01003333F8 /* XCTest.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
5E2FFB5C18367C01003333F8 /* CWNotificationDemo */ = {
isa = PBXGroup;
children = (
5E2FFB6518367C01003333F8 /* AppDelegate.h */,
5E2FFB6618367C01003333F8 /* AppDelegate.m */,
5E2FFB8918367C75003333F8 /* View Controllers */,
5E2FFB6818367C01003333F8 /* Images.xcassets */,
5E2FFB5D18367C01003333F8 /* Supporting Files */,
);
path = CWNotificationDemo;
sourceTree = "<group>";
};
5E2FFB5D18367C01003333F8 /* Supporting Files */ = {
isa = PBXGroup;
children = (
5E7E40D919C0F9CF00A0E3E0 /* LaunchScreen.xib */,
5E2FFB5E18367C01003333F8 /* CWNotificationDemo-Info.plist */,
5E2FFB5F18367C01003333F8 /* InfoPlist.strings */,
5E2FFB6218367C01003333F8 /* main.m */,
5E2FFB6418367C01003333F8 /* CWNotificationDemo-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
5E2FFB8518367C1B003333F8 /* CWStatusBarNotification */ = {
isa = PBXGroup;
children = (
5E0D045C1838AE0D00CBFC35 /* CWStatusBarNotification.h */,
5E0D045D1838AE0D00CBFC35 /* CWStatusBarNotification.m */,
);
name = CWStatusBarNotification;
path = CWNotification;
sourceTree = "<group>";
};
5E2FFB8918367C75003333F8 /* View Controllers */ = {
isa = PBXGroup;
children = (
5E2FFB8A18367C85003333F8 /* MainViewController */,
);
name = "View Controllers";
sourceTree = "<group>";
};
5E2FFB8A18367C85003333F8 /* MainViewController */ = {
isa = PBXGroup;
children = (
5E2FFB8B18367CA3003333F8 /* MainViewController.h */,
5E2FFB8C18367CA3003333F8 /* MainViewController.m */,
5E2FFB8D18367CA3003333F8 /* MainViewController.xib */,
);
name = MainViewController;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
5E2FFB5218367C01003333F8 /* CWNotificationDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5E2FFB7F18367C01003333F8 /* Build configuration list for PBXNativeTarget "CWNotificationDemo" */;
buildPhases = (
5E2FFB4F18367C01003333F8 /* Sources */,
5E2FFB5018367C01003333F8 /* Frameworks */,
5E2FFB5118367C01003333F8 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = CWNotificationDemo;
productName = CWNotificationDemo;
productReference = 5E2FFB5318367C01003333F8 /* CWNotificationDemo.app */;
productType = "com.apple.product-type.application";
};
5E2FFB6D18367C01003333F8 /* CWNotificationDemoTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5E2FFB8218367C01003333F8 /* Build configuration list for PBXNativeTarget "CWNotificationDemoTests" */;
buildPhases = (
5E2FFB6A18367C01003333F8 /* Sources */,
5E2FFB6B18367C01003333F8 /* Frameworks */,
5E2FFB6C18367C01003333F8 /* Resources */,
);
buildRules = (
);
dependencies = (
5E2FFB7418367C01003333F8 /* PBXTargetDependency */,
);
name = CWNotificationDemoTests;
productName = CWNotificationDemoTests;
productReference = 5E2FFB6E18367C01003333F8 /* CWNotificationDemoTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
5E2FFB4B18367C01003333F8 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = "Cezary Wojcik";
TargetAttributes = {
5E2FFB5218367C01003333F8 = {
DevelopmentTeam = QMZH6X9D3C;
};
5E2FFB6D18367C01003333F8 = {
TestTargetID = 5E2FFB5218367C01003333F8;
};
};
};
buildConfigurationList = 5E2FFB4E18367C01003333F8 /* Build configuration list for PBXProject "CWNotificationDemo" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 5E2FFB4A18367C01003333F8;
productRefGroup = 5E2FFB5418367C01003333F8 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
5E2FFB5218367C01003333F8 /* CWNotificationDemo */,
5E2FFB6D18367C01003333F8 /* CWNotificationDemoTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
5E2FFB5118367C01003333F8 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5E7E40DA19C0F9CF00A0E3E0 /* LaunchScreen.xib in Resources */,
5E2FFB6118367C01003333F8 /* InfoPlist.strings in Resources */,
5E2FFB8F18367CA3003333F8 /* MainViewController.xib in Resources */,
5E2FFB6918367C01003333F8 /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5E2FFB6C18367C01003333F8 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
5E2FFB4F18367C01003333F8 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5E0D045E1838AE0D00CBFC35 /* CWStatusBarNotification.m in Sources */,
5E2FFB6718367C01003333F8 /* AppDelegate.m in Sources */,
5E2FFB6318367C01003333F8 /* main.m in Sources */,
5E2FFB8E18367CA3003333F8 /* MainViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5E2FFB6A18367C01003333F8 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
5E2FFB7418367C01003333F8 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 5E2FFB5218367C01003333F8 /* CWNotificationDemo */;
targetProxy = 5E2FFB7318367C01003333F8 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
5E2FFB5F18367C01003333F8 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
5E2FFB6018367C01003333F8 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
5E2FFB7D18367C01003333F8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
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;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
5E2FFB7E18367C01003333F8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
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;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
5E2FFB8018367C01003333F8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "CWNotificationDemo/CWNotificationDemo-Prefix.pch";
INFOPLIST_FILE = "CWNotificationDemo/CWNotificationDemo-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
5E2FFB8118367C01003333F8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "CWNotificationDemo/CWNotificationDemo-Prefix.pch";
INFOPLIST_FILE = "CWNotificationDemo/CWNotificationDemo-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
name = Release;
};
5E2FFB8318367C01003333F8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CWNotificationDemo.app/CWNotificationDemo";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "CWNotificationDemo/CWNotificationDemo-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "CWNotificationDemoTests/CWNotificationDemoTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
5E2FFB8418367C01003333F8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CWNotificationDemo.app/CWNotificationDemo";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "CWNotificationDemo/CWNotificationDemo-Prefix.pch";
INFOPLIST_FILE = "CWNotificationDemoTests/CWNotificationDemoTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
5E2FFB4E18367C01003333F8 /* Build configuration list for PBXProject "CWNotificationDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5E2FFB7D18367C01003333F8 /* Debug */,
5E2FFB7E18367C01003333F8 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5E2FFB7F18367C01003333F8 /* Build configuration list for PBXNativeTarget "CWNotificationDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5E2FFB8018367C01003333F8 /* Debug */,
5E2FFB8118367C01003333F8 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5E2FFB8218367C01003333F8 /* Build configuration list for PBXNativeTarget "CWNotificationDemoTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5E2FFB8318367C01003333F8 /* Debug */,
5E2FFB8418367C01003333F8 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 5E2FFB4B18367C01003333F8 /* Project object */;
}
+15
View File
@@ -0,0 +1,15 @@
//
// AppDelegate.h
// CWNotificationDemo
//
// Created by Cezary Wojcik on 11/15/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
+54
View File
@@ -0,0 +1,54 @@
//
// AppDelegate.m
// CWNotificationDemo
//
// Created by Cezary Wojcik on 11/15/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import "AppDelegate.h"
#import "MainViewController.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
MainViewController *mainViewController = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
UINavigationController *navigationController = [UINavigationController new];
self.window.rootViewController = navigationController;
[navigationController pushViewController:mainViewController animated:NO];
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
@@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>cezarywojcik.dev.${PRODUCT_NAME:rfc1034identifier}</string>
<string>CW.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@@ -24,6 +24,8 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
@@ -13,5 +13,4 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#endif
+28
View File
@@ -0,0 +1,28 @@
<?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">
<dependencies>
<deployment defaultVersion="1792" identifier="iOS"/>
<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>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CWStatusBarNotification" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PyY-2A-t44">
<rect key="frame" x="119" y="279.5" width="363" height="40.5"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="34"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="centerY" secondItem="PyY-2A-t44" secondAttribute="centerY" constant="0.5" id="SYW-09-Sb1"/>
<constraint firstAttribute="centerX" secondItem="PyY-2A-t44" secondAttribute="centerX" id="xfo-fo-hOg"/>
</constraints>
</view>
</objects>
</document>
+25
View File
@@ -0,0 +1,25 @@
//
// MainViewController.h
// CWNotificationDemo
//
// Created by Cezary Wojcik on 11/15/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CWStatusBarNotification.h"
@interface MainViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *lblDuration;
@property (weak, nonatomic) IBOutlet UISlider *sliderDuration;
@property (weak, nonatomic) IBOutlet UITextField *txtNotificationMessage;
@property (weak, nonatomic) IBOutlet UISegmentedControl *segFromStyle;
@property (weak, nonatomic) IBOutlet UISegmentedControl *segToStyle;
@property (strong, nonatomic) CWStatusBarNotification *notification;
- (IBAction)sliderDurationChanged:(UISlider *)sender;
- (IBAction)btnShowNotificationPressed:(UIButton *)sender;
@end
+72
View File
@@ -0,0 +1,72 @@
//
// MainViewController.m
// CWNotificationDemo
//
// Created by Cezary Wojcik on 11/15/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import "MainViewController.h"
#import "CWStatusBarNotification.h"
@interface MainViewController ()
@end
@implementation MainViewController
@synthesize lblDuration, txtNotificationMessage, sliderDuration;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.title = @"CWStatusBarNotification";
[self updateDurationLabel];
UIFont *font = [UIFont boldSystemFontOfSize:10.0f];
NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
[self.segFromStyle setTitleTextAttributes:attributes forState:UIControlStateNormal];
[self.segToStyle setTitleTextAttributes:attributes forState:UIControlStateNormal];
// initialize CWNotification
self.notification = [CWStatusBarNotification new];
// set default blue color (since iOS 7.1, default window tintColor is black)
self.notification.notificationLabelBackgroundColor = [UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)updateDurationLabel
{
self.lblDuration.text = [NSString stringWithFormat:@"%f seconds", self.sliderDuration.value];
}
- (IBAction)sliderDurationChanged:(UISlider *)sender
{
[self updateDurationLabel];
}
# pragma mark - show notification
- (IBAction)btnShowNotificationPressed:(UIButton *)sender
{
self.notification.notificationAnimationInStyle = self.segFromStyle.selectedSegmentIndex;
self.notification.notificationAnimationOutStyle = self.segToStyle.selectedSegmentIndex;
[self.notification displayNotificationWithMessage:self.txtNotificationMessage.text forDuration:self.sliderDuration.value];
}
@end
+108
View File
@@ -0,0 +1,108 @@
<?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">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
<capability name="Alignment constraints to the first baseline" minToolsVersion="6.0"/>
</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="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"/>
<outlet property="txtNotificationMessage" destination="VqG-wR-oYI" id="Dgh-h3-sie"/>
<outlet property="view" destination="1" id="3"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="1">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<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"/>
<state key="normal" title="Show Notification">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="btnShowNotificationPressed:" destination="-1" eventType="touchUpInside" id="HRd-ca-gcu"/>
</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"/>
<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>
<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"/>
<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"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="Bza-7R-910">
<rect key="frame" x="20" y="114" width="374" height="29"/>
<segments>
<segment title="To Top"/>
<segment title="To Bottom"/>
<segment title="To Left"/>
<segment title="To Right"/>
</segments>
</segmentedControl>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="vWx-wx-d32">
<rect key="frame" x="20" y="78" width="374" height="29"/>
<segments>
<segment title="From Top"/>
<segment title="From Bottom"/>
<segment title="From Left"/>
<segment title="From Right"/>
</segments>
</segmentedControl>
</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"/>
</constraints>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
@@ -1,18 +1,18 @@
//
// main.m
// CWStatusBarNotificationDemo
// CWNotificationDemo
//
// Created by Cezary Wojcik on 9/18/13.
// Created by Cezary Wojcik on 11/15/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CWAppDelegate.h"
#import "AppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([CWAppDelegate class]));
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
+5 -5
View File
@@ -1,13 +1,13 @@
Pod::Spec.new do |s|
s.name = "CWStatusBarNotification"
s.version = "1.1.0"
s.summary = "A category on UIViewController to show a text notification in the status bar."
s.description = "CWStatusBarNotification adds a category on UIViewController that allows you to present a text-based notification in the status bar."
s.version = "2.1.2"
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 = "http://github.com/cezarywojcik/CWStatusBarNotification"
s.screenshots = "https://raw.github.com/cezarywojcik/CWStatusBarNotification/master/screenshot.png"
s.screenshots = "https://raw.github.com/cezarywojcik/CWStatusBarNotification/master/screenshots/screenshot.png"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Cezary Wojcik" => "me@cezarywojcik.com" }
s.platform = :ios, '6.0'
s.platform = :ios, '7.0'
s.source = { :git => "https://github.com/cezarywojcik/CWStatusBarNotification.git",
:tag => s.version.to_s }
s.source_files = 'CWStatusBarNotification'
@@ -0,0 +1,62 @@
//
// CWStatusBarNotification
// CWNotificationDemo
//
// Created by Cezary Wojcik on 11/15/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void(^CWCompletionBlock)(void);
@interface ScrollLabel : UILabel
- (CGFloat)scrollTime;
@end
@interface CWWindowContainer : UIWindow
@end
@interface CWStatusBarNotification : NSObject
typedef NS_ENUM(NSInteger, CWNotificationStyle) {
CWNotificationStyleStatusBarNotification,
CWNotificationStyleNavigationBarNotification
};
typedef NS_ENUM(NSInteger, CWNotificationAnimationStyle) {
CWNotificationAnimationStyleTop,
CWNotificationAnimationStyleBottom,
CWNotificationAnimationStyleLeft,
CWNotificationAnimationStyleRight
};
typedef NS_ENUM(NSInteger, CWNotificationAnimationType) {
CWNotificationAnimationTypeReplace,
CWNotificationAnimationTypeOverlay
};
@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;
@property (strong, nonatomic) UIView *statusBarView;
@property (copy, nonatomic) CWCompletionBlock notificationTappedBlock;
@property (nonatomic) CWNotificationAnimationStyle notificationStyle;
@property (nonatomic) CWNotificationAnimationStyle notificationAnimationInStyle;
@property (nonatomic) CWNotificationAnimationStyle notificationAnimationOutStyle;
@property (nonatomic) CWNotificationAnimationType notificationAnimationType;
@property (nonatomic) BOOL notificationIsShowing;
@property (nonatomic) BOOL notificationIsDismissing;
@property (strong, nonatomic) CWWindowContainer *notificationWindow;
- (void)displayNotificationWithMessage:(NSString *)message forDuration:(CGFloat)duration;
- (void)displayNotificationWithMessage:(NSString *)message completion:(void (^)(void))completion;
- (void)dismissNotification;
@end
@@ -0,0 +1,454 @@
//
// CWStatusBarNotification.m
// CWNotificationDemo
//
// Created by Cezary Wojcik on 11/15/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import <QuartzCore/QuartzCore.h>
#import "CWStatusBarNotification.h"
#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
{
if (point.y > 0 && point.y < [UIApplication sharedApplication].statusBarFrame.size.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);
}
# pragma mark - ScrollLabel
@implementation ScrollLabel
{
UIImageView *textImage;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
textImage = [[UIImageView alloc] init];
[self addSubview:textImage];
}
return self;
}
- (CGFloat)fullWidth
{
return [self.text sizeWithAttributes:@{NSFontAttributeName: self.font}].width;
}
- (CGFloat)scrollOffset
{
if (self.numberOfLines != 1) return 0;
CGRect insetRect = CGRectInset(self.bounds, PADDING, 0);
return MAX(0, [self fullWidth] - insetRect.size.width);
}
- (CGFloat)scrollTime
{
return ([self scrollOffset] > 0) ? [self scrollOffset] / SCROLL_SPEED + SCROLL_DELAY : 0;
}
- (void)drawTextInRect:(CGRect)rect
{
if ([self scrollOffset] > 0) {
rect.size.width = [self fullWidth] + PADDING * 2;
UIGraphicsBeginImageContextWithOptions(rect.size, NO, [UIScreen mainScreen].scale);
[super drawTextInRect:rect];
textImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[textImage sizeToFit];
[UIView animateWithDuration:[self scrollTime] - SCROLL_DELAY
delay:SCROLL_DELAY
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut
animations:^{
textImage.transform = CGAffineTransformMakeTranslation(-[self scrollOffset], 0);
} completion:^(BOOL finished) {
}];
} else {
textImage.image = nil;
[super drawTextInRect:CGRectInset(rect, PADDING, 0)];
}
}
@end
# pragma mark - CWStatusBarNotification
@interface CWStatusBarNotification()
@property (strong, nonatomic) UITapGestureRecognizer *tapGestureRecognizer;
@property (strong, nonatomic) CWDelayedBlockHandle dismissHandle;
@end
@implementation CWStatusBarNotification
@synthesize notificationLabel, notificationLabelBackgroundColor, notificationLabelTextColor, notificationWindow;
@synthesize statusBarView;
@synthesize notificationStyle, notificationIsShowing;
- (CWStatusBarNotification *)init
{
self = [super init];
if (self) {
// set defaults
self.notificationLabelBackgroundColor = [[UIApplication sharedApplication] delegate].window.tintColor;
self.notificationLabelTextColor = [UIColor whiteColor];
self.notificationStyle = CWNotificationStyleStatusBarNotification;
self.notificationAnimationInStyle = CWNotificationAnimationStyleBottom;
self.notificationAnimationOutStyle = CWNotificationAnimationStyleBottom;
self.notificationAnimationType = CWNotificationAnimationTypeReplace;
self.notificationIsDismissing = NO;
// 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) {
if (!weakSelf.notificationIsDismissing) {
[weakSelf dismissNotification];
}
};
}
return self;
}
# pragma mark - dimensions
- (CGFloat)getStatusBarHeight
{
if (self.notificationLabelHeight > 0) {
return self.notificationLabelHeight;
}
CGFloat statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
if (SYSTEM_VERSION_LESS_THAN(@"8.0") && UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.width;
}
return statusBarHeight > 0 ? statusBarHeight : 20;
}
- (CGFloat)getStatusBarWidth
{
if (SYSTEM_VERSION_LESS_THAN(@"8.0") && UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
return [UIScreen mainScreen].bounds.size.height;
}
return [UIScreen mainScreen].bounds.size.width;
}
- (CGFloat)getStatusBarOffset
{
if ([self getStatusBarHeight] == 40.0f) {
return -20.0f;
}
return 0.0f;
}
- (CGRect)getNotificationLabelTopFrame
{
return CGRectMake(0, [self getStatusBarOffset] + -1*[self getNotificationLabelHeight], [self getStatusBarWidth], [self getNotificationLabelHeight]);
}
- (CGRect)getNotificationLabelLeftFrame
{
return CGRectMake(-1*[self getStatusBarWidth], [self getStatusBarOffset], [self getStatusBarWidth], [self getNotificationLabelHeight]);
}
- (CGRect)getNotificationLabelRightFrame
{
return CGRectMake([self getStatusBarWidth], [self getStatusBarOffset], [self getStatusBarWidth], [self getNotificationLabelHeight]);
}
- (CGRect)getNotificationLabelBottomFrame
{
return CGRectMake(0, [self getStatusBarOffset] + [self getNotificationLabelHeight], [self getStatusBarWidth], 0);
}
- (CGRect)getNotificationLabelFrame
{
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];
self.statusBarView.hidden = YES;
}
# pragma mark - on tap
- (void)notificationTapped:(UITapGestureRecognizer*)recognizer
{
[self.notificationTappedBlock invoke];
}
# pragma mark - display helpers
- (void)createNotificationLabelWithMessage:(NSString *)message
{
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];
switch (self.notificationAnimationInStyle) {
case CWNotificationAnimationStyleTop:
self.notificationLabel.frame = [self getNotificationLabelTopFrame];
break;
case CWNotificationAnimationStyleBottom:
self.notificationLabel.frame = [self getNotificationLabelBottomFrame];
break;
case CWNotificationAnimationStyleLeft:
self.notificationLabel.frame = [self getNotificationLabelLeftFrame];
break;
case CWNotificationAnimationStyleRight:
self.notificationLabel.frame = [self getNotificationLabelRightFrame];
break;
}
}
- (void)createNotificationWindow
{
self.notificationWindow = [[CWWindowContainer alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.notificationWindow.backgroundColor = [UIColor clearColor];
self.notificationWindow.userInteractionEnabled = YES;
self.notificationWindow.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.notificationWindow.windowLevel = UIWindowLevelStatusBar;
self.notificationWindow.rootViewController = [UIViewController new];
}
- (void)createStatusBarView
{
self.statusBarView = [[UIView alloc] initWithFrame:[self getNotificationLabelFrame]];
self.statusBarView.clipsToBounds = YES;
if (self.notificationAnimationType == CWNotificationAnimationTypeReplace) {
UIView *statusBarImageView = [[UIScreen mainScreen] snapshotViewAfterScreenUpdates:YES];
[self.statusBarView addSubview:statusBarImageView];
}
[self.notificationWindow.rootViewController.view addSubview:self.statusBarView];
[self.notificationWindow.rootViewController.view sendSubviewToBack:self.statusBarView];
}
# pragma mark - frame changing
- (void)firstFrameChange
{
self.notificationLabel.frame = [self getNotificationLabelFrame];
switch (self.notificationAnimationInStyle) {
case CWNotificationAnimationStyleTop:
self.statusBarView.frame = [self getNotificationLabelBottomFrame];
break;
case CWNotificationAnimationStyleBottom:
self.statusBarView.frame = [self getNotificationLabelTopFrame];
break;
case CWNotificationAnimationStyleLeft:
self.statusBarView.frame = [self getNotificationLabelRightFrame];
break;
case CWNotificationAnimationStyleRight:
self.statusBarView.frame = [self getNotificationLabelLeftFrame];
break;
}
}
- (void)secondFrameChange
{
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]);
break;
case CWNotificationAnimationStyleLeft:
self.statusBarView.frame = [self getNotificationLabelRightFrame];
break;
case CWNotificationAnimationStyleRight:
self.statusBarView.frame = [self getNotificationLabelLeftFrame];
break;
}
}
- (void)thirdFrameChange
{
self.statusBarView.frame = [self getNotificationLabelFrame];
switch (self.notificationAnimationOutStyle) {
case CWNotificationAnimationStyleTop:
self.notificationLabel.frame = [self getNotificationLabelTopFrame];
break;
case CWNotificationAnimationStyleBottom:
self.notificationLabel.transform = CGAffineTransformMakeScale(1.0f, 0.01f);
break;
case CWNotificationAnimationStyleLeft:
self.notificationLabel.frame = [self getNotificationLabelLeftFrame];
break;
case CWNotificationAnimationStyleRight:
self.notificationLabel.frame = [self getNotificationLabelRightFrame];
break;
}
}
# pragma mark - display notification
- (void)displayNotificationWithMessage:(NSString *)message completion:(void (^)(void))completion
{
if (!self.notificationIsShowing) {
self.notificationIsShowing = YES;
// create UIWindow
[self createNotificationWindow];
// create ScrollLabel
[self createNotificationLabelWithMessage:message];
// create status bar view
[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:^{
[self firstFrameChange];
} completion:^(BOOL finished) {
double delayInSeconds = [self.notificationLabel scrollTime];
perform_block_after_delay(delayInSeconds, ^{
[completion invoke];
});
}];
}
}
- (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
{
[self displayNotificationWithMessage:message completion:^{
self.dismissHandle = perform_block_after_delay(duration, ^{
[self dismissNotification];
});
}];
}
@end
@@ -1,20 +0,0 @@
//
// UIViewController+CWStatusBarNotification.h
// CWStatusBarNotificationDemo
//
// Created by Cezary Wojcik on 9/18/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIViewController (CWStatusBarNotification)
- (void)showStatusBarNotification:(NSString *)message forDuration:(CGFloat)duration;
@property (nonatomic, readwrite) BOOL statusBarIsHidden;
@property (nonatomic, readwrite) BOOL statusBarNotificationIsShowing;
@property (nonatomic, readwrite) UILabel *statusBarNotificationLabel;
@property (nonatomic, readwrite) UIWindow *notificationWindow;
@end
@@ -1,140 +0,0 @@
//
// UIViewController+CWStatusBarNotification.m
// CWStatusBarNotificationDemo
//
// Created by Cezary Wojcik on 9/18/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import "UIViewController+CWStatusBarNotification.h"
#import <objc/runtime.h>
@implementation UIViewController (CWStatusBarNotification);
#define STATUS_BAR_ANIMATION_LENGTH 0.25f
#define FONT_SIZE 12.0f
NSString const *CWStatusBarIsHiddenKey = @"CWStatusBarIsHiddenKey";
NSString const *CWStatusBarNotificationIsShowingKey = @"CWStatusBarNotificationIsShowingKey";
NSString const *CWStatusBarNotificationLabelKey = @"CWStatusBarNotificationLabelKey";
NSString const *CWNotificationWindowKey = @"CWNotificationWindow";
# pragma mark - overriding functions
# pragma mark - dimensions
- (CGFloat)getStatusBarHeight {
CGFloat statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
if (UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.width;
}
return statusBarHeight;
}
- (CGFloat)getStatusBarWidth {
if (UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
return [UIScreen mainScreen].bounds.size.width;
}
return [UIScreen mainScreen].bounds.size.height;
}
- (CGRect)getStatusBarHiddenFrame {
return CGRectMake(0, -1*[self getStatusBarHeight], [self getStatusBarWidth], [self getStatusBarHeight]);
}
- (CGRect)getStatusBarFrame {
return CGRectMake(0, 0, [self getStatusBarWidth], [self getStatusBarHeight]);
}
# pragma mark - show status bar notification function
- (void)showStatusBarNotification:(NSString *)message forDuration:(CGFloat)duration {
if (!self.statusBarNotificationIsShowing) {
self.statusBarNotificationIsShowing = YES;
self.statusBarNotificationLabel.frame = [self getStatusBarHiddenFrame];
self.statusBarNotificationLabel.text = message;
self.statusBarNotificationLabel.textAlignment = NSTextAlignmentCenter;
self.statusBarNotificationLabel.adjustsFontSizeToFitWidth = YES;
self.statusBarNotificationLabel.font = [UIFont systemFontOfSize:FONT_SIZE];
self.notificationWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.notificationWindow.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.notificationWindow.backgroundColor = [UIColor clearColor];
self.notificationWindow.userInteractionEnabled = NO;
self.notificationWindow.windowLevel = UIWindowLevelStatusBar;
self.notificationWindow.rootViewController = [UIViewController new];
[self.notificationWindow.rootViewController.view addSubview:self.statusBarNotificationLabel];
[self.notificationWindow.rootViewController.view bringSubviewToFront:self.statusBarNotificationLabel];
[self.notificationWindow setHidden:NO];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenOrientationChanged) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
CGRect statusBarFrame = [self getStatusBarFrame];
[UIView animateWithDuration:STATUS_BAR_ANIMATION_LENGTH animations:^{
self.statusBarNotificationLabel.frame = statusBarFrame;
} completion:^(BOOL finished) {
[UIView animateWithDuration:duration - 2*STATUS_BAR_ANIMATION_LENGTH animations:^{
} completion:^(BOOL finished) {
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[UIView animateWithDuration:STATUS_BAR_ANIMATION_LENGTH animations:^{
self.statusBarNotificationLabel.frame = [self getStatusBarHiddenFrame];
} completion:^(BOOL finished) {
[self.statusBarNotificationLabel removeFromSuperview];
self.notificationWindow = nil;
self.statusBarNotificationIsShowing = NO;
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
}];
});
}];
}];
}
}
- (IBAction)txtFieldEditingDidEnd:(UITextField *)sender {
}
# pragma mark - screen orientation change
- (void)screenOrientationChanged {
self.statusBarNotificationLabel.frame = [self getStatusBarFrame];
}
# pragma mark - getters/setters
- (void)setStatusBarIsHidden:(BOOL)statusBarIsHidden {
objc_setAssociatedObject(self, &CWStatusBarIsHiddenKey, [NSNumber numberWithBool:statusBarIsHidden], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (BOOL)statusBarIsHidden {
return [objc_getAssociatedObject(self, &CWStatusBarIsHiddenKey) boolValue];
}
- (void)setStatusBarNotificationIsShowing:(BOOL)statusBarNotificationIsShowing {
objc_setAssociatedObject(self, &CWStatusBarNotificationIsShowingKey, [NSNumber numberWithBool:statusBarNotificationIsShowing], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (BOOL)statusBarNotificationIsShowing {
return [objc_getAssociatedObject(self, &CWStatusBarNotificationIsShowingKey) boolValue];
}
- (void)setStatusBarNotificationLabel:(UILabel *)statusBarNotificationLabel {
objc_setAssociatedObject(self, &CWStatusBarNotificationLabelKey, statusBarNotificationLabel, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (UILabel *)statusBarNotificationLabel {
if (objc_getAssociatedObject(self, &CWStatusBarNotificationLabelKey) == nil) {
[self setStatusBarNotificationLabel:[UILabel new]];
}
return objc_getAssociatedObject(self, &CWStatusBarNotificationLabelKey);
}
- (void)setNotificationWindow:(UIWindow *)notificationWindow {
objc_setAssociatedObject(self, &CWNotificationWindowKey, notificationWindow, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (UIWindow *)notificationWindow {
return objc_getAssociatedObject(self, &CWNotificationWindowKey);
}
@end
@@ -1,522 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
CE8882C217EAD71900A6F491 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE8882C117EAD71900A6F491 /* Foundation.framework */; };
CE8882C417EAD71900A6F491 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE8882C317EAD71900A6F491 /* CoreGraphics.framework */; };
CE8882C617EAD71900A6F491 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE8882C517EAD71900A6F491 /* UIKit.framework */; };
CE8882C817EAD71900A6F491 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE8882C717EAD71900A6F491 /* CoreData.framework */; };
CE8882CE17EAD71900A6F491 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = CE8882CC17EAD71900A6F491 /* InfoPlist.strings */; };
CE8882D017EAD71900A6F491 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8882CF17EAD71900A6F491 /* main.m */; };
CE8882D417EAD71900A6F491 /* CWAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8882D317EAD71900A6F491 /* CWAppDelegate.m */; };
CE8882D717EAD71900A6F491 /* CWStatusBarNotificationDemo.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = CE8882D517EAD71900A6F491 /* CWStatusBarNotificationDemo.xcdatamodeld */; };
CE8882D917EAD71900A6F491 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CE8882D817EAD71900A6F491 /* Images.xcassets */; };
CE8882E017EAD71900A6F491 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE8882DF17EAD71900A6F491 /* XCTest.framework */; };
CE8882E117EAD71900A6F491 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE8882C117EAD71900A6F491 /* Foundation.framework */; };
CE8882E217EAD71900A6F491 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE8882C517EAD71900A6F491 /* UIKit.framework */; };
CE8882E317EAD71900A6F491 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE8882C717EAD71900A6F491 /* CoreData.framework */; };
CE8882EB17EAD71900A6F491 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = CE8882E917EAD71900A6F491 /* InfoPlist.strings */; };
CE8882ED17EAD71900A6F491 /* CWStatusBarNotificationDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8882EC17EAD71900A6F491 /* CWStatusBarNotificationDemoTests.m */; };
CE8882F917EAD78400A6F491 /* UIViewController+CWStatusBarNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8882F817EAD78400A6F491 /* UIViewController+CWStatusBarNotification.m */; };
CE88830417EAD86900A6F491 /* CWSampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE88830217EAD86900A6F491 /* CWSampleViewController.m */; };
CE88830517EAD86900A6F491 /* CWSampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE88830317EAD86900A6F491 /* CWSampleViewController.xib */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
CE8882E417EAD71900A6F491 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = CE8882B617EAD71900A6F491 /* Project object */;
proxyType = 1;
remoteGlobalIDString = CE8882BD17EAD71900A6F491;
remoteInfo = CWStatusBarNotificationDemo;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
CE8882BE17EAD71900A6F491 /* CWStatusBarNotificationDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CWStatusBarNotificationDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
CE8882C117EAD71900A6F491 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
CE8882C317EAD71900A6F491 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
CE8882C517EAD71900A6F491 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
CE8882C717EAD71900A6F491 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
CE8882CB17EAD71900A6F491 /* CWStatusBarNotificationDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CWStatusBarNotificationDemo-Info.plist"; sourceTree = "<group>"; };
CE8882CD17EAD71900A6F491 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
CE8882CF17EAD71900A6F491 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
CE8882D117EAD71900A6F491 /* CWStatusBarNotificationDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CWStatusBarNotificationDemo-Prefix.pch"; sourceTree = "<group>"; };
CE8882D217EAD71900A6F491 /* CWAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CWAppDelegate.h; sourceTree = "<group>"; };
CE8882D317EAD71900A6F491 /* CWAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CWAppDelegate.m; sourceTree = "<group>"; };
CE8882D617EAD71900A6F491 /* CWStatusBarNotificationDemo.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = CWStatusBarNotificationDemo.xcdatamodel; sourceTree = "<group>"; };
CE8882D817EAD71900A6F491 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
CE8882DE17EAD71900A6F491 /* CWStatusBarNotificationDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CWStatusBarNotificationDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
CE8882DF17EAD71900A6F491 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
CE8882E817EAD71900A6F491 /* CWStatusBarNotificationDemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CWStatusBarNotificationDemoTests-Info.plist"; sourceTree = "<group>"; };
CE8882EA17EAD71900A6F491 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
CE8882EC17EAD71900A6F491 /* CWStatusBarNotificationDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CWStatusBarNotificationDemoTests.m; sourceTree = "<group>"; };
CE8882F717EAD78400A6F491 /* UIViewController+CWStatusBarNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+CWStatusBarNotification.h"; sourceTree = "<group>"; };
CE8882F817EAD78400A6F491 /* UIViewController+CWStatusBarNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+CWStatusBarNotification.m"; sourceTree = "<group>"; };
CE88830117EAD86900A6F491 /* CWSampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CWSampleViewController.h; path = CWStatusBarNotificationDemo/CWSampleViewController.h; sourceTree = "<group>"; };
CE88830217EAD86900A6F491 /* CWSampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CWSampleViewController.m; path = CWStatusBarNotificationDemo/CWSampleViewController.m; sourceTree = "<group>"; };
CE88830317EAD86900A6F491 /* CWSampleViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CWSampleViewController.xib; path = CWStatusBarNotificationDemo/CWSampleViewController.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
CE8882BB17EAD71900A6F491 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
CE8882C417EAD71900A6F491 /* CoreGraphics.framework in Frameworks */,
CE8882C817EAD71900A6F491 /* CoreData.framework in Frameworks */,
CE8882C617EAD71900A6F491 /* UIKit.framework in Frameworks */,
CE8882C217EAD71900A6F491 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
CE8882DB17EAD71900A6F491 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
CE8882E017EAD71900A6F491 /* XCTest.framework in Frameworks */,
CE8882E317EAD71900A6F491 /* CoreData.framework in Frameworks */,
CE8882E217EAD71900A6F491 /* UIKit.framework in Frameworks */,
CE8882E117EAD71900A6F491 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
CE8882B517EAD71900A6F491 = {
isa = PBXGroup;
children = (
CE8882F617EAD75F00A6F491 /* CWStatusBarNotification */,
CE8882C917EAD71900A6F491 /* CWStatusBarNotificationDemo */,
CE8882E617EAD71900A6F491 /* CWStatusBarNotificationDemoTests */,
CE8882C017EAD71900A6F491 /* Frameworks */,
CE8882BF17EAD71900A6F491 /* Products */,
);
sourceTree = "<group>";
};
CE8882BF17EAD71900A6F491 /* Products */ = {
isa = PBXGroup;
children = (
CE8882BE17EAD71900A6F491 /* CWStatusBarNotificationDemo.app */,
CE8882DE17EAD71900A6F491 /* CWStatusBarNotificationDemoTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
CE8882C017EAD71900A6F491 /* Frameworks */ = {
isa = PBXGroup;
children = (
CE8882C117EAD71900A6F491 /* Foundation.framework */,
CE8882C317EAD71900A6F491 /* CoreGraphics.framework */,
CE8882C517EAD71900A6F491 /* UIKit.framework */,
CE8882C717EAD71900A6F491 /* CoreData.framework */,
CE8882DF17EAD71900A6F491 /* XCTest.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
CE8882C917EAD71900A6F491 /* CWStatusBarNotificationDemo */ = {
isa = PBXGroup;
children = (
CE8882D217EAD71900A6F491 /* CWAppDelegate.h */,
CE8882D317EAD71900A6F491 /* CWAppDelegate.m */,
CE8882FA17EAD81600A6F491 /* View Controllers */,
CE8882D817EAD71900A6F491 /* Images.xcassets */,
CE8882D517EAD71900A6F491 /* CWStatusBarNotificationDemo.xcdatamodeld */,
CE8882CA17EAD71900A6F491 /* Supporting Files */,
);
path = CWStatusBarNotificationDemo;
sourceTree = "<group>";
};
CE8882CA17EAD71900A6F491 /* Supporting Files */ = {
isa = PBXGroup;
children = (
CE8882CB17EAD71900A6F491 /* CWStatusBarNotificationDemo-Info.plist */,
CE8882CC17EAD71900A6F491 /* InfoPlist.strings */,
CE8882CF17EAD71900A6F491 /* main.m */,
CE8882D117EAD71900A6F491 /* CWStatusBarNotificationDemo-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
CE8882E617EAD71900A6F491 /* CWStatusBarNotificationDemoTests */ = {
isa = PBXGroup;
children = (
CE8882EC17EAD71900A6F491 /* CWStatusBarNotificationDemoTests.m */,
CE8882E717EAD71900A6F491 /* Supporting Files */,
);
path = CWStatusBarNotificationDemoTests;
sourceTree = "<group>";
};
CE8882E717EAD71900A6F491 /* Supporting Files */ = {
isa = PBXGroup;
children = (
CE8882E817EAD71900A6F491 /* CWStatusBarNotificationDemoTests-Info.plist */,
CE8882E917EAD71900A6F491 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
CE8882F617EAD75F00A6F491 /* CWStatusBarNotification */ = {
isa = PBXGroup;
children = (
CE8882F717EAD78400A6F491 /* UIViewController+CWStatusBarNotification.h */,
CE8882F817EAD78400A6F491 /* UIViewController+CWStatusBarNotification.m */,
);
path = CWStatusBarNotification;
sourceTree = "<group>";
};
CE8882FA17EAD81600A6F491 /* View Controllers */ = {
isa = PBXGroup;
children = (
CE88830117EAD86900A6F491 /* CWSampleViewController.h */,
CE88830217EAD86900A6F491 /* CWSampleViewController.m */,
CE88830317EAD86900A6F491 /* CWSampleViewController.xib */,
);
name = "View Controllers";
path = ..;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
CE8882BD17EAD71900A6F491 /* CWStatusBarNotificationDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = CE8882F017EAD71900A6F491 /* Build configuration list for PBXNativeTarget "CWStatusBarNotificationDemo" */;
buildPhases = (
CE8882BA17EAD71900A6F491 /* Sources */,
CE8882BB17EAD71900A6F491 /* Frameworks */,
CE8882BC17EAD71900A6F491 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = CWStatusBarNotificationDemo;
productName = CWStatusBarNotificationDemo;
productReference = CE8882BE17EAD71900A6F491 /* CWStatusBarNotificationDemo.app */;
productType = "com.apple.product-type.application";
};
CE8882DD17EAD71900A6F491 /* CWStatusBarNotificationDemoTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = CE8882F317EAD71900A6F491 /* Build configuration list for PBXNativeTarget "CWStatusBarNotificationDemoTests" */;
buildPhases = (
CE8882DA17EAD71900A6F491 /* Sources */,
CE8882DB17EAD71900A6F491 /* Frameworks */,
CE8882DC17EAD71900A6F491 /* Resources */,
);
buildRules = (
);
dependencies = (
CE8882E517EAD71900A6F491 /* PBXTargetDependency */,
);
name = CWStatusBarNotificationDemoTests;
productName = CWStatusBarNotificationDemoTests;
productReference = CE8882DE17EAD71900A6F491 /* CWStatusBarNotificationDemoTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
CE8882B617EAD71900A6F491 /* Project object */ = {
isa = PBXProject;
attributes = {
CLASSPREFIX = CW;
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = "Cezary Wojcik";
TargetAttributes = {
CE8882BD17EAD71900A6F491 = {
DevelopmentTeam = QMZH6X9D3C;
};
CE8882DD17EAD71900A6F491 = {
TestTargetID = CE8882BD17EAD71900A6F491;
};
};
};
buildConfigurationList = CE8882B917EAD71900A6F491 /* Build configuration list for PBXProject "CWStatusBarNotificationDemo" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = CE8882B517EAD71900A6F491;
productRefGroup = CE8882BF17EAD71900A6F491 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
CE8882BD17EAD71900A6F491 /* CWStatusBarNotificationDemo */,
CE8882DD17EAD71900A6F491 /* CWStatusBarNotificationDemoTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
CE8882BC17EAD71900A6F491 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CE88830517EAD86900A6F491 /* CWSampleViewController.xib in Resources */,
CE8882CE17EAD71900A6F491 /* InfoPlist.strings in Resources */,
CE8882D917EAD71900A6F491 /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
CE8882DC17EAD71900A6F491 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CE8882EB17EAD71900A6F491 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
CE8882BA17EAD71900A6F491 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CE88830417EAD86900A6F491 /* CWSampleViewController.m in Sources */,
CE8882D417EAD71900A6F491 /* CWAppDelegate.m in Sources */,
CE8882D717EAD71900A6F491 /* CWStatusBarNotificationDemo.xcdatamodeld in Sources */,
CE8882D017EAD71900A6F491 /* main.m in Sources */,
CE8882F917EAD78400A6F491 /* UIViewController+CWStatusBarNotification.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
CE8882DA17EAD71900A6F491 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CE8882ED17EAD71900A6F491 /* CWStatusBarNotificationDemoTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
CE8882E517EAD71900A6F491 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = CE8882BD17EAD71900A6F491 /* CWStatusBarNotificationDemo */;
targetProxy = CE8882E417EAD71900A6F491 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
CE8882CC17EAD71900A6F491 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
CE8882CD17EAD71900A6F491 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
CE8882E917EAD71900A6F491 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
CE8882EA17EAD71900A6F491 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
CE8882EE17EAD71900A6F491 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
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;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
CE8882EF17EAD71900A6F491 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
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;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
CE8882F117EAD71900A6F491 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "CWStatusBarNotificationDemo/CWStatusBarNotificationDemo-Prefix.pch";
INFOPLIST_FILE = "CWStatusBarNotificationDemo/CWStatusBarNotificationDemo-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
CE8882F217EAD71900A6F491 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "CWStatusBarNotificationDemo/CWStatusBarNotificationDemo-Prefix.pch";
INFOPLIST_FILE = "CWStatusBarNotificationDemo/CWStatusBarNotificationDemo-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
CE8882F417EAD71900A6F491 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CWStatusBarNotificationDemo.app/CWStatusBarNotificationDemo";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "CWStatusBarNotificationDemo/CWStatusBarNotificationDemo-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "CWStatusBarNotificationDemoTests/CWStatusBarNotificationDemoTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
CE8882F517EAD71900A6F491 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CWStatusBarNotificationDemo.app/CWStatusBarNotificationDemo";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "CWStatusBarNotificationDemo/CWStatusBarNotificationDemo-Prefix.pch";
INFOPLIST_FILE = "CWStatusBarNotificationDemoTests/CWStatusBarNotificationDemoTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
CE8882B917EAD71900A6F491 /* Build configuration list for PBXProject "CWStatusBarNotificationDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CE8882EE17EAD71900A6F491 /* Debug */,
CE8882EF17EAD71900A6F491 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
CE8882F017EAD71900A6F491 /* Build configuration list for PBXNativeTarget "CWStatusBarNotificationDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CE8882F117EAD71900A6F491 /* Debug */,
CE8882F217EAD71900A6F491 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
CE8882F317EAD71900A6F491 /* Build configuration list for PBXNativeTarget "CWStatusBarNotificationDemoTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CE8882F417EAD71900A6F491 /* Debug */,
CE8882F517EAD71900A6F491 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
/* End XCConfigurationList section */
/* Begin XCVersionGroup section */
CE8882D517EAD71900A6F491 /* CWStatusBarNotificationDemo.xcdatamodeld */ = {
isa = XCVersionGroup;
children = (
CE8882D617EAD71900A6F491 /* CWStatusBarNotificationDemo.xcdatamodel */,
);
currentVersion = CE8882D617EAD71900A6F491 /* CWStatusBarNotificationDemo.xcdatamodel */;
path = CWStatusBarNotificationDemo.xcdatamodeld;
sourceTree = "<group>";
versionGroupType = wrapper.xcdatamodel;
};
/* End XCVersionGroup section */
};
rootObject = CE8882B617EAD71900A6F491 /* Project object */;
}
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:CWStatusBarNotificationDemo.xcodeproj">
</FileRef>
</Workspace>
@@ -1,96 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CE8882BD17EAD71900A6F491"
BuildableName = "CWStatusBarNotificationDemo.app"
BlueprintName = "CWStatusBarNotificationDemo"
ReferencedContainer = "container:CWStatusBarNotificationDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CE8882DD17EAD71900A6F491"
BuildableName = "CWStatusBarNotificationDemoTests.xctest"
BlueprintName = "CWStatusBarNotificationDemoTests"
ReferencedContainer = "container:CWStatusBarNotificationDemo.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CE8882BD17EAD71900A6F491"
BuildableName = "CWStatusBarNotificationDemo.app"
BlueprintName = "CWStatusBarNotificationDemo"
ReferencedContainer = "container:CWStatusBarNotificationDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CE8882BD17EAD71900A6F491"
BuildableName = "CWStatusBarNotificationDemo.app"
BlueprintName = "CWStatusBarNotificationDemo"
ReferencedContainer = "container:CWStatusBarNotificationDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CE8882BD17EAD71900A6F491"
BuildableName = "CWStatusBarNotificationDemo.app"
BlueprintName = "CWStatusBarNotificationDemo"
ReferencedContainer = "container:CWStatusBarNotificationDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -1,27 +0,0 @@
<?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>SchemeUserState</key>
<dict>
<key>CWStatusBarNotificationDemo.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>CE8882BD17EAD71900A6F491</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>CE8882DD17EAD71900A6F491</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
@@ -1,22 +0,0 @@
//
// CWAppDelegate.h
// CWStatusBarNotificationDemo
//
// Created by Cezary Wojcik on 9/18/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CWAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;
@end
-154
View File
@@ -1,154 +0,0 @@
//
// CWAppDelegate.m
// CWStatusBarNotificationDemo
//
// Created by Cezary Wojcik on 9/18/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import "CWAppDelegate.h"
#import "CWSampleViewController.h"
@implementation CWAppDelegate
@synthesize managedObjectContext = _managedObjectContext;
@synthesize managedObjectModel = _managedObjectModel;
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
CWSampleViewController *sampleViewController = [[CWSampleViewController alloc] initWithNibName:@"CWSampleViewController" bundle:nil];
UINavigationController *navigationController = [UINavigationController new];
self.window.rootViewController = navigationController;
[navigationController pushViewController:sampleViewController animated:YES];
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Saves changes in the application's managed object context before the application terminates.
[self saveContext];
}
- (void)saveContext
{
NSError *error = nil;
NSManagedObjectContext *managedObjectContext = self.managedObjectContext;
if (managedObjectContext != nil) {
if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
}
}
#pragma mark - Core Data stack
// Returns the managed object context for the application.
// If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application.
- (NSManagedObjectContext *)managedObjectContext
{
if (_managedObjectContext != nil) {
return _managedObjectContext;
}
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
if (coordinator != nil) {
_managedObjectContext = [[NSManagedObjectContext alloc] init];
[_managedObjectContext setPersistentStoreCoordinator:coordinator];
}
return _managedObjectContext;
}
// Returns the managed object model for the application.
// If the model doesn't already exist, it is created from the application's model.
- (NSManagedObjectModel *)managedObjectModel
{
if (_managedObjectModel != nil) {
return _managedObjectModel;
}
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"CWStatusBarNotificationDemo" withExtension:@"momd"];
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
return _managedObjectModel;
}
// Returns the persistent store coordinator for the application.
// If the coordinator doesn't already exist, it is created and the application's store added to it.
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (_persistentStoreCoordinator != nil) {
return _persistentStoreCoordinator;
}
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"CWStatusBarNotificationDemo.sqlite"];
NSError *error = nil;
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
/*
Replace this implementation with code to handle the error appropriately.
abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
Typical reasons for an error here include:
* The persistent store is not accessible;
* The schema for the persistent store is incompatible with current managed object model.
Check the error message to determine what the actual problem was.
If the persistent store is not accessible, there is typically something wrong with the file path. Often, a file URL is pointing into the application's resources directory instead of a writeable directory.
If you encounter schema incompatibility errors during development, you can reduce their frequency by:
* Simply deleting the existing store:
[[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil]
* Performing automatic lightweight migration by passing the following dictionary as the options parameter:
@{NSMigratePersistentStoresAutomaticallyOption:@YES, NSInferMappingModelAutomaticallyOption:@YES}
Lightweight migration will only work for a limited set of schema changes; consult "Core Data Model Versioning and Data Migration Programming Guide" for details.
*/
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
return _persistentStoreCoordinator;
}
#pragma mark - Application's Documents directory
// Returns the URL to the application's Documents directory.
- (NSURL *)applicationDocumentsDirectory
{
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
@end
@@ -1,19 +0,0 @@
//
// CWSampleViewController.h
// CWStatusBarNotificationDemo
//
// Created by Cezary Wojcik on 9/18/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CWSampleViewController : UIViewController
@property (strong, nonatomic) IBOutlet UITextField *textField;
@property (strong, nonatomic) IBOutlet UISlider *slider;
@property (strong, nonatomic) IBOutlet UILabel *label;
- (IBAction)sliderValueChanged:(UISlider *)sender;
@end
@@ -1,54 +0,0 @@
//
// CWSampleViewController.m
// CWStatusBarNotificationDemo
//
// Created by Cezary Wojcik on 9/18/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import "CWSampleViewController.h"
#import "UIViewController+CWStatusBarNotification.h"
@interface CWSampleViewController ()
@end
@implementation CWSampleViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[self sliderValueChanged:nil];
self.title = @"CWStatusBarNotification";
// setup status bar notification visuals
self.statusBarNotificationLabel.textColor = [UIColor whiteColor];
self.statusBarNotificationLabel.backgroundColor = self.view.tintColor;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)btnShowNotification:(UIButton *)sender {
// display notification
[self showStatusBarNotification:self.textField.text forDuration:self.slider.value];
}
- (IBAction)sliderValueChanged:(UISlider *)sender {
NSString *labelText = [NSString stringWithFormat:@"Duration: %f seconds", self.slider.value];
self.label.text = labelText;
}
@end
@@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4510" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment defaultVersion="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="CWSampleViewController">
<connections>
<outlet property="label" destination="vWS-51-pZK" id="iJs-QB-uJY"/>
<outlet property="slider" destination="OmA-2w-f6U" id="VeU-YT-yPi"/>
<outlet property="textField" destination="b05-o2-vNO" id="rEI-Vs-m9A"/>
<outlet property="view" destination="1" id="3"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="1">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2HW-YD-pSU">
<rect key="frame" x="100" y="269" width="121" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Show Notification">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="btnShowNotification:" destination="-1" eventType="touchUpInside" id="ywZ-Mn-kXw"/>
</connections>
</button>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Notification Text" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="b05-o2-vNO">
<rect key="frame" x="27" y="231" width="273" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="txtFieldEditingDidEnd:" destination="-1" eventType="editingDidEnd" id="05i-ja-tsU"/>
</connections>
</textField>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="10" translatesAutoresizingMaskIntoConstraints="NO" id="OmA-2w-f6U">
<rect key="frame" x="25" y="190" width="277" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
<action selector="sliderValueChanged:" destination="-1" eventType="valueChanged" id="68h-ee-HdI"/>
</connections>
</slider>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vWS-51-pZK">
<rect key="frame" x="27" y="161" width="273" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="OmA-2w-f6U" firstAttribute="top" secondItem="vWS-51-pZK" secondAttribute="bottom" constant="8" id="0IG-RX-1tU"/>
<constraint firstAttribute="centerX" secondItem="2HW-YD-pSU" secondAttribute="centerX" constant="-0.5" id="1Nk-TF-emp"/>
<constraint firstAttribute="centerY" secondItem="2HW-YD-pSU" secondAttribute="centerY" id="1SV-MZ-5ia"/>
<constraint firstAttribute="trailing" secondItem="b05-o2-vNO" secondAttribute="trailing" constant="20" id="3GR-Yj-nSd"/>
<constraint firstItem="2HW-YD-pSU" firstAttribute="top" secondItem="b05-o2-vNO" secondAttribute="bottom" constant="8" id="Lxf-5Q-ZXL"/>
<constraint firstItem="vWS-51-pZK" firstAttribute="width" secondItem="OmA-2w-f6U" secondAttribute="width" id="RPv-CJ-1u0"/>
<constraint firstItem="OmA-2w-f6U" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="27" id="Vru-g9-xcj"/>
<constraint firstItem="b05-o2-vNO" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="27" id="cRo-NU-WIe"/>
<constraint firstAttribute="centerX" secondItem="b05-o2-vNO" secondAttribute="centerX" constant="-3.5" id="cTM-5u-OOZ"/>
<constraint firstItem="b05-o2-vNO" firstAttribute="top" secondItem="OmA-2w-f6U" secondAttribute="bottom" constant="8" id="o2b-0d-Fzo"/>
<constraint firstItem="b05-o2-vNO" firstAttribute="width" secondItem="OmA-2w-f6U" secondAttribute="width" id="v8i-sd-swe"/>
<constraint firstItem="vWS-51-pZK" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="27" id="zdy-3b-ugd"/>
</constraints>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
</view>
</objects>
</document>
@@ -1,8 +0,0 @@
<?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>_XCCurrentVersionName</key>
<string>CWStatusBarNotificationDemo.xcdatamodel</string>
</dict>
</plist>
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model name="Test1.xcdatamodel" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1" systemVersion="11A491" minimumToolsVersion="Automatic" macOSVersion="Automatic" iOSVersion="Automatic">
<elements/>
</model>
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2013 Cezary Wojcik <http://www.cezarywojcik.com>
Copyright (c) 2014 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
+95 -18
View File
@@ -1,12 +1,16 @@
# CWStatusBarNotification
`CSStatusBarNotification` is a category on UIViewController that allows you to easily create text-based notifications that appear on the status bar.
[![Build Status](https://travis-ci.org/cezarywojcik/CWStatusBarNotification.png?branch=master)](https://travis-ci.org/cezarywojcik/CWStatusBarNotification)
![screenshot](demo.gif)
**NOTE:** You can find a `Swift` 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.
![demo](screenshots/demo.gif)
## Requirements
CWStatsBarNotification uses ARC and requires iOS 6.0+.
`CWStatusBarNotification` uses ARC and requires iOS 7.0+.
Works for iPhone and iPad.
@@ -14,7 +18,7 @@ Works for iPhone and iPad.
### CocoaPods
`pod 'CWStatusBarNotification', '~> 1.0.2'`
`pod 'CWStatusBarNotification', '~> 2.1.2'`
### Manual
@@ -22,34 +26,107 @@ Copy the folder `CWStatusBarNotification` to your project.
## Usage
Use the following import statement in the View Controller you wish to use this with:
***Note:** The previous version of this library implemented the notifications using a category. This version uses an object instead.*
#import "UIViewController+CWStatusBarNotification.h"
Firstly, you need the following import statement:
Now, to trigger a notification:
```
#import "CWStatusBarNotification.h"
```
NSString *notificationText = @"This is a test notification";
CGFloat duration = 1.0f;
[self showStatusBarNotification:notificationText forDuration:duration];
Now, you need to create a `CWStatusBarNotification` object. It is recommended that you do so by attaching it as a property to a `UIViewController`.
### Customization
```
CWStatusBarNotification *notification = [CWStatusBarNotification new];
```
After you have a `CWStatusBarNotification` object, you can simply call the `displayNotificationMessage:forDuration:` method:
The category adds a new property to `UIViewController` called `statusBarNotificationLabel`. Here is an example usage:
```
[self.notification displayNotificationWithMessage:@"Hello, World!"
forDuration:1.0f];
```
self.statusBarNotificationLabel.textColor = [UIColor whiteColor];
self.statusBarNotificationLabel.backgroundColor = self.view.tintColor;
If you prefer to manually choose when to display and dismiss the notification, you can do so as well:
```
[self.notification displayNotificationWithMessage:@"Hello" completion:nil];
// wait until you need to dismiss
[self.notification dismissNotification];
```
### Behavior on Tap
The default behavior when the notification is tapped is to dismiss it. However, you can override this behavior by setting the `onTapNotification` block to something different.
For example:
```
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:
```
__weak typeof(self) weakSelf = self;
self.notification.notificationTappedBlock = ^(void) {
if (!weakSelf.notificationIsDismissing) {
[weakSelf dismissNotification];
// more code here
}
};
```
## Customizing Appearance
First of all, you can customize the background color and text color using the following properties: `notificationLabelBackgroundColor` and `notificationLabelTextColor`.
Example:
```
notification.notificationLabelBackgroundColor = [UIColor blackColor];
notification.notificationLabelTextColor = [UIColor greenColor];
```
![custom colors](screenshots/ss1.gif)
The default value of `notificationLabelBackgroundColor` is `[[UIApplication sharedApplication] delegate].window.tintColor`.
The default value of `notification.notificationLabelTextColor` is `[UIColor whiteColor]`.
Finally, you can also choose from two styles - a notification the size of the status bar, or a notification the size of the status bar and a navigation bar. Simply change the `notificationStyle` property of the `CWStatusBarNotification` object to either `CWNotificationStyleStatusBarNotification` or `CWNotificationStyleNavigationBarNotification`.
![custom style](screenshots/ss2.gif)
The default value of `notificationStyle` is `CWNotificationStyleStatusBarNotification`.
## Customizing Animation
There are two properties that determine the animation style of the notification: `notificationAnimationInStyle` and `notificationAnimationOutStyle`. Each can take on one of four values:
* `CWNotificationAnimationStyleTop`
* `CWNotificationAnimationStyleBottom`
* `CWNotificationAnimationStyleLeft`
* `CWNotificationAnimationStyleRight`
The `notificationAnimationInStyle` describes where the notification comes from, whereas the `notificationAnimationOutStyle` describes where the notification will go.
The default value for `notificationAnimationInStyle` is `CWNotificationAnimationStyleTop`.
The default value for `notificationAnimationOutStyle` is `CWNotificationAnimationStyleTop`.
### Additional Remarks
Queueing is not yet implemented. As such, if you trigger a notification while a notification is already showing, nothing will happen. You can check whether the notification is showing with the Boolean property `self.statusBarNotificationIsShowing` in UIViewController.
Screen orientation changing is fully supported.
The notifications will work in both screen orientations, however, screen rotation while a notification is displayed is not yet fully supported.
## License
The MIT License (MIT)
Copyright (c) 2013 Cezary Wojcik <http://www.cezarywojcik.com>
Copyright (c) 2014 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
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB