Compare commits

..

63 Commits

Author SHA1 Message Date
Cezary Wojcik 513ca17ffe Merge pull request #82 from kshdeo/swift
Swift Style selectors + Option to change Font size
2016-04-06 23:11:46 -07:00
Kshitij Deo a3aa9ca98f Formatting update 2016-04-07 11:36:52 +05:30
Kshitij Deo 445eafc3cb var to let 2016-04-07 11:02:34 +05:30
Kshitij Deo ac71e2f702 Reverting Font size changes 2016-04-07 11:00:55 +05:30
Kshitij Deo c16a9a2e71 Font size is public property 2016-04-06 14:42:28 +05:30
Kshitij Deo ac19e17ed6 Updated to new Swift style selectors 2016-04-06 12:39:27 +05:30
Cezary Wojcik 43fa3d60a5 Merge pull request #71 from PorterHoskins/rotationCrash
Rotation Crash
2015-10-07 08:11:42 -07:00
Porter Hoskins c5591a9b96 Removed private modifier to allow NSNotificationCenter to call function 2015-10-07 08:39:00 -06:00
Cezary Wojcik 2583aa5fb3 Merge pull request #70 from PorterHoskins/tapCrash
Fixed crash for tapping on status bar notification
2015-09-23 11:34:16 -07:00
Porter Hoskins dbd9e6d0e2 Fixed crash for tapping on status bar notification 2015-09-23 11:15:36 -06:00
Cezary Wojcik be8a8e51a9 trying out framework 2015-08-27 11:48:35 -07:00
Cezary Wojcik 88623f80a2 added build scheme 2015-08-25 12:40:55 -07:00
Cezary Wojcik 8c82ea5491 updated version number, if it matters 2015-07-12 19:24:58 -07:00
Cezary Wojcik b8b570c653 exposed enums to objective c 2015-07-12 19:19:44 -07:00
Cezary Wojcik 25335e297f updated demo gif 2015-07-12 19:16:21 -07:00
Cezary Wojcik bc4651499c added comment 2015-07-12 19:12:25 -07:00
Cezary Wojcik 3630ed6530 updated read 2015-07-12 19:07:54 -07:00
Cezary Wojcik d770665406 rewritten for Swift 2.0 2015-07-12 19:05:17 -07:00
Cezary Wojcik 63530d03ea Merge pull request #58 from mmcurtis55/swift
corrected errors caused by the newest version of swift.
2015-07-11 02:01:24 -07:00
mmcurtis55 9f1e7647ad corrected errors 2015-06-23 13:33:55 -05:00
Cezary Wojcik f7c7f5748f Merge pull request #46 from daylen/swift
Make the completion handler optional
2014-12-17 21:41:04 -08:00
Daylen Yang 3cdb92430b Fix issue with calling completion handler 2014-12-16 21:04:24 -08:00
Daylen Yang 95483a05ad Make the completion handler optional
Make the ? operator apply to the closure by putting in an extra set of parentheses.
2014-12-16 20:59:16 -08:00
Cezary Wojcik 2654541077 Merge pull request #34 from ricardopereira/swift-6.1
Xcode 6.1 compatibility
2014-10-10 01:43:58 -07:00
Ricardo Pereira dff58153e7 Xcode 6.1 compatibility 2014-10-09 17:13:58 +01:00
Cezary Wojcik 134b753a53 var -> let 2014-06-08 20:42:26 -07:00
Cezary Wojcik 51a988134e added a space 2014-06-08 20:40:58 -07:00
Cezary Wojcik 23effa5578 seeing double 2014-06-08 14:33:39 -07:00
Cezary Wojcik 062d342186 removed a copy 2014-06-08 14:31:58 -07:00
Cezary Wojcik 8cbd86b8f4 updated readme 2014-06-08 14:27:28 -07:00
Cezary Wojcik 6a7394f5e6 updated readme 2014-06-08 14:23:33 -07:00
Cezary Wojcik 3dd6a619d9 moved most initialization to property declarations 2014-06-08 13:47:07 -07:00
Cezary Wojcik 1338cd1b55 conversion to swift 2014-06-08 01:59:44 -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
Cezary Wojcik 0972fa0949 1.1.0 2013-11-14 21:42:27 -08:00
Cezary Wojcik 8395fa1b96 Changed to use UIWindow 2013-11-14 21:35:05 -08:00
Cezary Wojcik 4a843c6022 Merge pull request #3 from 4ndrey/master
Removing warnings
2013-10-13 08:30:14 -07:00
Andrey Toropchin 8358c7e4a7 Removing warnings 2013-10-13 16:00:04 +06:00
Cezary Wojcik 06a4d35d82 Small fix. 2013-10-12 12:27:54 -07:00
Cezary Wojcik fa9b5635ee podspec 2013-10-03 23:38:04 -07:00
Cezary Wojcik 18f8092416 Version 1.0.2
Updated to get status bar height programmatically
2013-10-03 23:22:09 -07:00
Cezary Wojcik 7596d2631a Updated README for CocoaPods 2013-09-19 14:30:19 -07:00
Cezary Wojcik 15047c5264 1.0.1 2013-09-19 13:54:55 -07:00
50 changed files with 2252 additions and 1196 deletions
+1
View File
@@ -0,0 +1 @@
language: objective-c
@@ -0,0 +1,335 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
5EB250971B5350580093E304 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EB250961B5350580093E304 /* AppDelegate.swift */; };
5EB250991B5350580093E304 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EB250981B5350580093E304 /* MainViewController.swift */; };
5EB2509C1B5350580093E304 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EB2509A1B5350580093E304 /* Main.storyboard */; };
5EB2509E1B5350580093E304 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5EB2509D1B5350580093E304 /* Assets.xcassets */; };
5EB250A11B5350580093E304 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EB2509F1B5350580093E304 /* LaunchScreen.storyboard */; };
5EC0FBB71B8F8C2900704169 /* CustomView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5EC0FBB61B8F8C2900704169 /* CustomView.xib */; };
5EC0FBBC1B8F8ED500704169 /* CWStatusBarNotification.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5EC0FBB81B8F8E6A00704169 /* CWStatusBarNotification.framework */; };
5EC0FBBD1B8F8ED500704169 /* CWStatusBarNotification.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5EC0FBB81B8F8E6A00704169 /* CWStatusBarNotification.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
5EC0FBBE1B8F8ED500704169 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
5EC0FBBD1B8F8ED500704169 /* CWStatusBarNotification.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
5EB250931B5350580093E304 /* CWNotificationDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CWNotificationDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
5EB250961B5350580093E304 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5EB250981B5350580093E304 /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
5EB2509B1B5350580093E304 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
5EB2509D1B5350580093E304 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5EB250A01B5350580093E304 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5EB250A21B5350580093E304 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5EC0FBB61B8F8C2900704169 /* CustomView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CustomView.xib; sourceTree = "<group>"; };
5EC0FBB81B8F8E6A00704169 /* CWStatusBarNotification.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CWStatusBarNotification.framework; path = CWStatusBarNotification/CWStatusBarNotification.framework; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
5EB250901B5350580093E304 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
5EC0FBBC1B8F8ED500704169 /* CWStatusBarNotification.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
5EB2508A1B5350580093E304 = {
isa = PBXGroup;
children = (
5EB250A81B5350600093E304 /* CWStatusBarNotification */,
5EB250951B5350580093E304 /* CWNotificationDemo */,
5EB250941B5350580093E304 /* Products */,
);
sourceTree = "<group>";
};
5EB250941B5350580093E304 /* Products */ = {
isa = PBXGroup;
children = (
5EB250931B5350580093E304 /* CWNotificationDemo.app */,
);
name = Products;
sourceTree = "<group>";
};
5EB250951B5350580093E304 /* CWNotificationDemo */ = {
isa = PBXGroup;
children = (
5EB250961B5350580093E304 /* AppDelegate.swift */,
5EB250981B5350580093E304 /* MainViewController.swift */,
5EB2509A1B5350580093E304 /* Main.storyboard */,
5EB2509F1B5350580093E304 /* LaunchScreen.storyboard */,
5EC0FBB61B8F8C2900704169 /* CustomView.xib */,
5EB2509D1B5350580093E304 /* Assets.xcassets */,
5EB250A21B5350580093E304 /* Info.plist */,
);
path = CWNotificationDemo;
sourceTree = "<group>";
};
5EB250A81B5350600093E304 /* CWStatusBarNotification */ = {
isa = PBXGroup;
children = (
5EC0FBB81B8F8E6A00704169 /* CWStatusBarNotification.framework */,
);
name = CWStatusBarNotification;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
5EB250921B5350580093E304 /* CWNotificationDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5EB250A51B5350580093E304 /* Build configuration list for PBXNativeTarget "CWNotificationDemo" */;
buildPhases = (
5EB2508F1B5350580093E304 /* Sources */,
5EB250901B5350580093E304 /* Frameworks */,
5EB250911B5350580093E304 /* Resources */,
5EC0FBBE1B8F8ED500704169 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = CWNotificationDemo;
productName = CWNotificationDemo;
productReference = 5EB250931B5350580093E304 /* CWNotificationDemo.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
5EB2508B1B5350580093E304 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = "Cezary Wojcik";
TargetAttributes = {
5EB250921B5350580093E304 = {
CreatedOnToolsVersion = 7.0;
};
};
};
buildConfigurationList = 5EB2508E1B5350580093E304 /* Build configuration list for PBXProject "CWNotificationDemo" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 5EB2508A1B5350580093E304;
productRefGroup = 5EB250941B5350580093E304 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
5EB250921B5350580093E304 /* CWNotificationDemo */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
5EB250911B5350580093E304 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5EB250A11B5350580093E304 /* LaunchScreen.storyboard in Resources */,
5EC0FBB71B8F8C2900704169 /* CustomView.xib in Resources */,
5EB2509E1B5350580093E304 /* Assets.xcassets in Resources */,
5EB2509C1B5350580093E304 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
5EB2508F1B5350580093E304 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5EB250991B5350580093E304 /* MainViewController.swift in Sources */,
5EB250971B5350580093E304 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
5EB2509A1B5350580093E304 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
5EB2509B1B5350580093E304 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
5EB2509F1B5350580093E304 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
5EB250A01B5350580093E304 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
5EB250A31B5350580093E304 /* 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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
5EB250A41B5350580093E304 /* 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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
5EB250A61B5350580093E304 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/CWStatusBarNotification",
);
INFOPLIST_FILE = CWNotificationDemo/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = CW.CWNotificationDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
5EB250A71B5350580093E304 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/CWStatusBarNotification",
);
INFOPLIST_FILE = CWNotificationDemo/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = CW.CWNotificationDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
5EB2508E1B5350580093E304 /* Build configuration list for PBXProject "CWNotificationDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5EB250A31B5350580093E304 /* Debug */,
5EB250A41B5350580093E304 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5EB250A51B5350580093E304 /* Build configuration list for PBXNativeTarget "CWNotificationDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5EB250A61B5350580093E304 /* Debug */,
5EB250A71B5350580093E304 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 5EB2508B1B5350580093E304 /* Project object */;
}
+46
View File
@@ -0,0 +1,46 @@
//
// AppDelegate.swift
// CWNotificationDemo
//
// Created by Cezary Wojcik on 7/12/15.
// Copyright © 2015 Cezary Wojcik. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(application: UIApplication) {
// 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.
}
func applicationDidEnterBackground(application: UIApplication) {
// 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.
}
func applicationWillEnterForeground(application: UIApplication) {
// 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.
}
func applicationDidBecomeActive(application: UIApplication) {
// 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.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
@@ -5,16 +5,31 @@
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8152.3" systemVersion="15A216g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="QpS-sz-u2p">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8124.4"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--Main View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="MainViewController" customModule="CWNotificationDemo" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="1UY-SC-Dlj">
<rect key="frame" x="20" y="72" width="560" height="29"/>
<animations/>
<segments>
<segment title="From Top"/>
<segment title="From Bottom"/>
<segment title="From Left"/>
<segment title="From Right"/>
</segments>
</segmentedControl>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="aiP-me-Edw">
<rect key="frame" x="20" y="108" width="560" height="29"/>
<animations/>
<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="01l-OU-YTs">
<rect key="frame" x="20" y="144" width="560" height="29"/>
<animations/>
<segments>
<segment title="Status Bar"/>
<segment title="Navigation Bar"/>
</segments>
</segmentedControl>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="10" translatesAutoresizingMaskIntoConstraints="NO" id="HxP-Xe-Dpi">
<rect key="frame" x="18" y="180" width="564" height="31"/>
<animations/>
<connections>
<action selector="sliderDurationChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="dH5-wH-CG2"/>
</connections>
</slider>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Duration: " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1zE-R3-GMR">
<rect key="frame" x="20" y="218" width="75" height="20.5"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Wbo-6H-X5Z">
<rect key="frame" x="98" y="218" width="42" height="20.5"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="1Rz-8M-TP7">
<rect key="frame" x="20" y="248" width="560" height="30"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fcJ-3d-KJL">
<rect key="frame" x="240" y="286" width="121" height="30"/>
<animations/>
<state key="normal" title="Show Notification"/>
<connections>
<action selector="btnShowNotificationPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="LRF-Da-EzM"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ry1-EC-da7">
<rect key="frame" x="192" y="324" width="216" height="30"/>
<animations/>
<state key="normal" title="Show Custom View Notification"/>
<connections>
<action selector="btnShowCustomNotificationPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="HmQ-6U-Lks"/>
</connections>
</button>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Wbo-6H-X5Z" firstAttribute="leading" secondItem="1zE-R3-GMR" secondAttribute="trailing" constant="3" id="2LZ-ih-fVM"/>
<constraint firstAttribute="leadingMargin" secondItem="1Rz-8M-TP7" secondAttribute="leading" id="4PN-JI-8I1"/>
<constraint firstAttribute="trailingMargin" secondItem="1UY-SC-Dlj" secondAttribute="trailing" id="7XX-LR-Had"/>
<constraint firstAttribute="leadingMargin" secondItem="aiP-me-Edw" secondAttribute="leading" id="D8i-Ow-rGN"/>
<constraint firstAttribute="trailingMargin" secondItem="01l-OU-YTs" secondAttribute="trailing" id="Ejd-k4-Dee"/>
<constraint firstAttribute="leadingMargin" secondItem="HxP-Xe-Dpi" secondAttribute="leading" id="FNy-pC-mNT"/>
<constraint firstItem="ry1-EC-da7" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="He1-cv-l7M"/>
<constraint firstItem="fcJ-3d-KJL" firstAttribute="top" secondItem="1Rz-8M-TP7" secondAttribute="bottom" constant="8" id="Kxg-bI-RI3"/>
<constraint firstAttribute="trailingMargin" secondItem="HxP-Xe-Dpi" secondAttribute="trailing" id="Rrk-8o-fxZ"/>
<constraint firstItem="1zE-R3-GMR" firstAttribute="top" secondItem="HxP-Xe-Dpi" secondAttribute="bottom" constant="8" id="Sk0-Ka-STc"/>
<constraint firstItem="01l-OU-YTs" firstAttribute="top" secondItem="aiP-me-Edw" secondAttribute="bottom" constant="8" id="SpS-Qt-aDx"/>
<constraint firstItem="1UY-SC-Dlj" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="8" id="VgS-tu-gi8"/>
<constraint firstItem="1Rz-8M-TP7" firstAttribute="top" secondItem="1zE-R3-GMR" secondAttribute="bottom" constant="9.5" id="Wce-Ac-dyK"/>
<constraint firstItem="Wbo-6H-X5Z" firstAttribute="top" secondItem="HxP-Xe-Dpi" secondAttribute="bottom" constant="8" id="WlR-Z4-lCN"/>
<constraint firstItem="ry1-EC-da7" firstAttribute="top" secondItem="fcJ-3d-KJL" secondAttribute="bottom" constant="8" id="WvV-Ik-N5a"/>
<constraint firstAttribute="leadingMargin" secondItem="01l-OU-YTs" secondAttribute="leading" id="ZSd-7u-GUp"/>
<constraint firstAttribute="leadingMargin" secondItem="1zE-R3-GMR" secondAttribute="leading" id="cc7-IT-fib"/>
<constraint firstAttribute="trailingMargin" secondItem="aiP-me-Edw" secondAttribute="trailing" id="d3D-an-x13"/>
<constraint firstItem="HxP-Xe-Dpi" firstAttribute="top" secondItem="01l-OU-YTs" secondAttribute="bottom" constant="8" id="fZk-zk-K9D"/>
<constraint firstItem="fcJ-3d-KJL" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="k5x-T9-oJ0"/>
<constraint firstItem="aiP-me-Edw" firstAttribute="top" secondItem="1UY-SC-Dlj" secondAttribute="bottom" constant="8" id="p3m-Tl-iFj"/>
<constraint firstAttribute="leadingMargin" secondItem="1UY-SC-Dlj" secondAttribute="leading" id="xWP-7N-GSi"/>
<constraint firstAttribute="trailingMargin" secondItem="1Rz-8M-TP7" secondAttribute="trailing" id="xfC-vI-7co"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="IMf-d6-Gvd"/>
<connections>
<outlet property="lblDuration" destination="Wbo-6H-X5Z" id="IGW-kk-vfR"/>
<outlet property="segFromStyle" destination="1UY-SC-Dlj" id="x4R-8M-hC4"/>
<outlet property="segNotificationStyle" destination="01l-OU-YTs" id="3Cy-CG-K5a"/>
<outlet property="segToStyle" destination="aiP-me-Edw" id="Smd-wy-ySI"/>
<outlet property="sliderDuration" destination="HxP-Xe-Dpi" id="abL-wz-PCv"/>
<outlet property="txtNotificationMessage" destination="1Rz-8M-TP7" id="kEW-gR-m1I"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="937" y="1080"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="qR2-eZ-SgX">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="QpS-sz-u2p" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="mIt-JP-OMn">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="9ox-hT-OMy"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="kG4-MI-5Nt" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="154" y="1080"/>
</scene>
</scenes>
</document>
+37
View File
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8173.3" systemVersion="15A263e" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8142"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" animating="YES" style="white" translatesAutoresizingMaskIntoConstraints="NO" id="vcr-0m-Ym1">
<rect key="frame" x="8" y="290" width="20" height="20"/>
<animations/>
<color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</activityIndicatorView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="This is a Custom View" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="42O-Eq-exg">
<rect key="frame" x="216" y="289" width="168" height="20.5"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="42O-Eq-exg" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="0zn-V7-Ozv"/>
<constraint firstItem="vcr-0m-Ym1" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="Epl-JG-bte"/>
<constraint firstItem="42O-Eq-exg" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="NA4-ry-NNm"/>
<constraint firstItem="vcr-0m-Ym1" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="8" id="OrX-Xh-jKc"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
</document>
@@ -4,16 +4,14 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>cezarywojcik.dev.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
@@ -21,9 +19,13 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
@@ -0,0 +1,94 @@
//
// MainViewController.swift
// CWNotificationDemo
//
// Created by Cezary Wojcik on 7/11/15.
// Copyright © 2015 Cezary Wojcik. All rights reserved.
//
import UIKit
import CWStatusBarNotification
class MainViewController: UIViewController {
// MARK: - IB outlets
@IBOutlet weak var lblDuration: UILabel!
@IBOutlet weak var sliderDuration: UISlider!
@IBOutlet weak var txtNotificationMessage: UITextField!
@IBOutlet weak var segFromStyle: UISegmentedControl!
@IBOutlet weak var segToStyle: UISegmentedControl!
@IBOutlet weak var segNotificationStyle: UISegmentedControl!
// MARK: - properties
let notification = CWStatusBarNotification()
// MARK: - setup
override func viewDidLoad() {
super.viewDidLoad()
self.title = "CWStatusBarNotification"
self.updateDurationLabel()
// setup font
let font = UIFont.boldSystemFontOfSize(10.0)
let attributes = [NSFontAttributeName : font]
self.segFromStyle.setTitleTextAttributes(attributes, forState: .Normal)
self.segToStyle.setTitleTextAttributes(attributes, forState: .Normal)
// set default blue color (since iOS 7.1, default window `tintColor`
// is black)
self.notification.notificationLabelBackgroundColor = UIColor(red: 0.0,
green: 122.0/255.0, blue: 1.0, alpha: 1.0)
}
// MARK: - methods
func updateDurationLabel() {
self.lblDuration.text = NSString(format: "%.1f seconds",
self.sliderDuration.value) as String
}
func setupNotification() {
guard let inStyle = CWNotificationAnimationStyle(rawValue:
self.segFromStyle.selectedSegmentIndex) else {
return
}
guard let outStyle = CWNotificationAnimationStyle(rawValue:
self.segToStyle.selectedSegmentIndex) else {
return
}
guard let notificationStyle = CWNotificationStyle(rawValue:
self.segNotificationStyle.selectedSegmentIndex) else {
return
}
self.notification.notificationAnimationInStyle = inStyle
self.notification.notificationAnimationOutStyle = outStyle
self.notification.notificationStyle = notificationStyle
}
// MARK: - IB actions
@IBAction func sliderDurationChanged(sender: UISlider) {
self.updateDurationLabel()
}
@IBAction func btnShowNotificationPressed(sender: UIButton) {
self.setupNotification()
let duration = NSTimeInterval(self.sliderDuration.value)
self.notification.displayNotificationWithMessage(
self.txtNotificationMessage.text!, forDuration: duration)
}
@IBAction func btnShowCustomNotificationPressed(sender: UIButton) {
self.setupNotification()
let duration = NSTimeInterval(self.sliderDuration.value)
guard let view = NSBundle.mainBundle().loadNibNamed("CustomView",
owner: nil, options: nil)[0] as? UIView else {
return
}
self.notification.displayNotificationWithView(view,
forDuration: duration)
}
}
+6 -6
View File
@@ -1,13 +1,13 @@
Pod::Spec.new do |s|
s.name = "CWStatusBarNotification"
s.version = "1.0.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.3.1"
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" => "cezarywojcik@cezarywojcik.com" }
s.platform = :ios, '6.0'
s.author = { "Cezary Wojcik" => "me@cezarywojcik.com" }
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,170 @@
// Generated by Apple Swift version 2.0 (swiftlang-700.0.52.2 clang-700.0.65)
#pragma clang diagnostic push
#if defined(__has_include) && __has_include(<swift/objc-prologue.h>)
# include <swift/objc-prologue.h>
#endif
#pragma clang diagnostic ignored "-Wauto-import"
#include <objc/NSObject.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#if defined(__has_include) && __has_include(<uchar.h>)
# include <uchar.h>
#elif !defined(__cplusplus) || __cplusplus < 201103L
typedef uint_least16_t char16_t;
typedef uint_least32_t char32_t;
#endif
typedef struct _NSZone NSZone;
#if !defined(SWIFT_PASTE)
# define SWIFT_PASTE_HELPER(x, y) x##y
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
#endif
#if !defined(SWIFT_METATYPE)
# define SWIFT_METATYPE(X) Class
#endif
#if defined(__has_attribute) && __has_attribute(objc_runtime_name)
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
#else
# define SWIFT_RUNTIME_NAME(X)
#endif
#if defined(__has_attribute) && __has_attribute(swift_name)
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
#else
# define SWIFT_COMPILE_NAME(X)
#endif
#if !defined(SWIFT_CLASS_EXTRA)
# define SWIFT_CLASS_EXTRA
#endif
#if !defined(SWIFT_PROTOCOL_EXTRA)
# define SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_ENUM_EXTRA)
# define SWIFT_ENUM_EXTRA
#endif
#if !defined(SWIFT_CLASS)
# if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# else
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# endif
#endif
#if !defined(SWIFT_PROTOCOL)
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_EXTENSION)
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
#endif
#if !defined(OBJC_DESIGNATED_INITIALIZER)
# if defined(__has_attribute) && __has_attribute(objc_designated_initializer)
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
# else
# define OBJC_DESIGNATED_INITIALIZER
# endif
#endif
#if !defined(SWIFT_ENUM)
# define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type
#endif
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
#if defined(__has_feature) && __has_feature(modules)
@import ObjectiveC;
@import CoreGraphics;
@import UIKit;
@import Foundation;
#endif
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
typedef SWIFT_ENUM(NSInteger, CWNotificationAnimationStyle) {
CWNotificationAnimationStyleTop = 0,
CWNotificationAnimationStyleBottom = 1,
CWNotificationAnimationStyleLeft = 2,
CWNotificationAnimationStyleRight = 3,
};
typedef SWIFT_ENUM(NSInteger, CWNotificationAnimationType) {
CWNotificationAnimationTypeReplace = 0,
CWNotificationAnimationTypeOverlay = 1,
};
typedef SWIFT_ENUM(NSInteger, CWNotificationStyle) {
CWNotificationStyleStatusBarNotification = 0,
CWNotificationStyleNavigationBarNotification = 1,
};
@class ScrollLabel;
@class UIView;
@class CWWindowContainer;
@class UIColor;
@class UIFont;
@class NSAttributedString;
SWIFT_CLASS("_TtC23CWStatusBarNotification23CWStatusBarNotification")
@interface CWStatusBarNotification : NSObject
@property (nonatomic) ScrollLabel * __nullable notificationLabel;
@property (nonatomic) UIView * __nullable statusBarView;
@property (nonatomic, copy) void (^ __nonnull notificationTappedClosure)(void);
@property (nonatomic) BOOL notificationIsShowing;
@property (nonatomic) BOOL notificationIsDismissing;
@property (nonatomic) CWWindowContainer * __nullable notificationWindow;
@property (nonatomic) UIColor * __nonnull notificationLabelBackgroundColor;
@property (nonatomic) UIColor * __nonnull notificationLabelTextColor;
@property (nonatomic) UIFont * __nonnull notificationLabelFont;
@property (nonatomic) CGFloat notificationLabelHeight;
@property (nonatomic) UIView * __nullable customView;
@property (nonatomic) BOOL multiline;
@property (nonatomic) UIInterfaceOrientationMask supportedInterfaceOrientations;
@property (nonatomic) NSTimeInterval notificationAnimationDuration;
@property (nonatomic) enum CWNotificationStyle notificationStyle;
@property (nonatomic) enum CWNotificationAnimationStyle notificationAnimationInStyle;
@property (nonatomic) enum CWNotificationAnimationStyle notificationAnimationOutStyle;
@property (nonatomic) enum CWNotificationAnimationType notificationAnimationType;
@property (nonatomic) UIStatusBarStyle preferredStatusBarStyle;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
- (void)displayNotificationWithMessage:(NSString * __nonnull)message completion:(void (^ __nonnull)(void))completion;
- (void)displayNotificationWithMessage:(NSString * __nonnull)message forDuration:(NSTimeInterval)duration;
- (void)displayNotificationWithAttributedString:(NSAttributedString * __nonnull)attributedString completion:(void (^ __nonnull)(void))completion;
- (void)displayNotificationWithAttributedString:(NSAttributedString * __nonnull)attributedString forDuration:(NSTimeInterval)duration;
- (void)displayNotificationWithView:(UIView * __nonnull)view completion:(void (^ __nonnull)(void))completion;
- (void)displayNotificationWithView:(UIView * __nonnull)view forDuration:(NSTimeInterval)duration;
- (void)dismissNotificationWithCompletion:(void (^ __nullable)(void))completion;
- (void)dismissNotification;
@end
@class UIEvent;
@class NSCoder;
SWIFT_CLASS("_TtC23CWStatusBarNotification17CWWindowContainer")
@interface CWWindowContainer : UIWindow
- (UIView * __nullable)hitTest:(CGPoint)pt withEvent:(UIEvent * __nullable)event;
- (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder * __nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER;
@end
SWIFT_CLASS("_TtC23CWStatusBarNotification11ScrollLabel")
@interface ScrollLabel : UILabel
- (nullable instancetype)initWithCoder:(NSCoder * __nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER;
- (void)drawTextInRect:(CGRect)rect;
@end
#pragma clang diagnostic pop
@@ -0,0 +1,19 @@
//
// CWStatusBarNotification.h
// CWStatusBarNotification
//
// Created by Cezary Wojcik on 8/27/15.
// Copyright © 2015 Cezary Wojcik. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for CWStatusBarNotification.
FOUNDATION_EXPORT double CWStatusBarNotificationVersionNumber;
//! Project version string for CWStatusBarNotification.
FOUNDATION_EXPORT const unsigned char CWStatusBarNotificationVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <CWStatusBarNotification/PublicHeader.h>
@@ -0,0 +1,10 @@
framework module CWStatusBarNotification {
umbrella header "CWStatusBarNotification.h"
export *
module * { export * }
}
module CWStatusBarNotification.Swift {
header "CWStatusBarNotification-Swift.h"
}
@@ -0,0 +1,167 @@
<?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>files</key>
<dict>
<key>Headers/CWStatusBarNotification-Swift.h</key>
<data>
sHk9UTdVUQ+K2bnEze4Om700M5g=
</data>
<key>Headers/CWStatusBarNotification.h</key>
<data>
dKyiSWNdnUbx8kFZhyBOJeSw0IM=
</data>
<key>Info.plist</key>
<data>
vnpKR34QNRjEzSLsaiVc3ESfYak=
</data>
<key>Modules/CWStatusBarNotification.swiftmodule/arm.swiftdoc</key>
<data>
G40ZKxZeGbDiufsVP/4VgPLgqGY=
</data>
<key>Modules/CWStatusBarNotification.swiftmodule/arm.swiftmodule</key>
<data>
GgtVi9uEw7MXifjf18ZZ5F6i7jE=
</data>
<key>Modules/CWStatusBarNotification.swiftmodule/arm64.swiftdoc</key>
<data>
Fq4/GBaJtuC5ZnCk+gF/L2KS1cY=
</data>
<key>Modules/CWStatusBarNotification.swiftmodule/arm64.swiftmodule</key>
<data>
ssTzLsTAKPUkfcl07Pa/xiV723g=
</data>
<key>Modules/module.modulemap</key>
<data>
92f/QlE0cBcXT4XFRh5+RB4ItR8=
</data>
</dict>
<key>files2</key>
<dict>
<key>Headers/CWStatusBarNotification-Swift.h</key>
<data>
sHk9UTdVUQ+K2bnEze4Om700M5g=
</data>
<key>Headers/CWStatusBarNotification.h</key>
<data>
dKyiSWNdnUbx8kFZhyBOJeSw0IM=
</data>
<key>Modules/CWStatusBarNotification.swiftmodule/arm.swiftdoc</key>
<data>
G40ZKxZeGbDiufsVP/4VgPLgqGY=
</data>
<key>Modules/CWStatusBarNotification.swiftmodule/arm.swiftmodule</key>
<data>
GgtVi9uEw7MXifjf18ZZ5F6i7jE=
</data>
<key>Modules/CWStatusBarNotification.swiftmodule/arm64.swiftdoc</key>
<data>
Fq4/GBaJtuC5ZnCk+gF/L2KS1cY=
</data>
<key>Modules/CWStatusBarNotification.swiftmodule/arm64.swiftmodule</key>
<data>
ssTzLsTAKPUkfcl07Pa/xiV723g=
</data>
<key>Modules/module.modulemap</key>
<data>
92f/QlE0cBcXT4XFRh5+RB4ItR8=
</data>
</dict>
<key>rules</key>
<dict>
<key>^</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
@@ -0,0 +1,299 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
5E9AB6E61B8F7A0E003F349E /* CWStatusBarNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 5E9AB6E51B8F7A0E003F349E /* CWStatusBarNotification.h */; settings = {ATTRIBUTES = (Public, ); }; };
5E9AB6EF1B8F7AA8003F349E /* CWStatusBarNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E9AB6ED1B8F7AA8003F349E /* CWStatusBarNotification.swift */; };
5E9AB6F01B8F7AA8003F349E /* CWStatusBarNotificationUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E9AB6EE1B8F7AA8003F349E /* CWStatusBarNotificationUtils.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
5E9AB6E21B8F7A0E003F349E /* CWStatusBarNotification.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CWStatusBarNotification.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5E9AB6E51B8F7A0E003F349E /* CWStatusBarNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CWStatusBarNotification.h; sourceTree = "<group>"; };
5E9AB6E71B8F7A0E003F349E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5E9AB6ED1B8F7AA8003F349E /* CWStatusBarNotification.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CWStatusBarNotification.swift; sourceTree = "<group>"; };
5E9AB6EE1B8F7AA8003F349E /* CWStatusBarNotificationUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CWStatusBarNotificationUtils.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
5E9AB6DE1B8F7A0E003F349E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
5E9AB6D81B8F7A0E003F349E = {
isa = PBXGroup;
children = (
5E9AB6E41B8F7A0E003F349E /* CWStatusBarNotification */,
5E9AB6E31B8F7A0E003F349E /* Products */,
);
sourceTree = "<group>";
};
5E9AB6E31B8F7A0E003F349E /* Products */ = {
isa = PBXGroup;
children = (
5E9AB6E21B8F7A0E003F349E /* CWStatusBarNotification.framework */,
);
name = Products;
sourceTree = "<group>";
};
5E9AB6E41B8F7A0E003F349E /* CWStatusBarNotification */ = {
isa = PBXGroup;
children = (
5E9AB6ED1B8F7AA8003F349E /* CWStatusBarNotification.swift */,
5E9AB6EE1B8F7AA8003F349E /* CWStatusBarNotificationUtils.swift */,
5E9AB6E51B8F7A0E003F349E /* CWStatusBarNotification.h */,
5E9AB6E71B8F7A0E003F349E /* Info.plist */,
);
path = CWStatusBarNotification;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
5E9AB6DF1B8F7A0E003F349E /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
5E9AB6E61B8F7A0E003F349E /* CWStatusBarNotification.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
5E9AB6E11B8F7A0E003F349E /* CWStatusBarNotification */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5E9AB6EA1B8F7A0E003F349E /* Build configuration list for PBXNativeTarget "CWStatusBarNotification" */;
buildPhases = (
5E9AB6DD1B8F7A0E003F349E /* Sources */,
5E9AB6DE1B8F7A0E003F349E /* Frameworks */,
5E9AB6DF1B8F7A0E003F349E /* Headers */,
5E9AB6E01B8F7A0E003F349E /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = CWStatusBarNotification;
productName = CWStatusBarNotification;
productReference = 5E9AB6E21B8F7A0E003F349E /* CWStatusBarNotification.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
5E9AB6D91B8F7A0E003F349E /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = "Cezary Wojcik";
TargetAttributes = {
5E9AB6E11B8F7A0E003F349E = {
CreatedOnToolsVersion = 7.0;
};
};
};
buildConfigurationList = 5E9AB6DC1B8F7A0E003F349E /* Build configuration list for PBXProject "CWStatusBarNotification" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 5E9AB6D81B8F7A0E003F349E;
productRefGroup = 5E9AB6E31B8F7A0E003F349E /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
5E9AB6E11B8F7A0E003F349E /* CWStatusBarNotification */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
5E9AB6E01B8F7A0E003F349E /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
5E9AB6DD1B8F7A0E003F349E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5E9AB6F01B8F7AA8003F349E /* CWStatusBarNotificationUtils.swift in Sources */,
5E9AB6EF1B8F7AA8003F349E /* CWStatusBarNotification.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
5E9AB6E81B8F7A0E003F349E /* 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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
5E9AB6E91B8F7A0E003F349E /* 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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
5E9AB6EB1B8F7A0E003F349E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = CWStatusBarNotification/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = CW.CWStatusBarNotification;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
5E9AB6EC1B8F7A0E003F349E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = CWStatusBarNotification/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = CW.CWStatusBarNotification;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
5E9AB6DC1B8F7A0E003F349E /* Build configuration list for PBXProject "CWStatusBarNotification" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5E9AB6E81B8F7A0E003F349E /* Debug */,
5E9AB6E91B8F7A0E003F349E /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5E9AB6EA1B8F7A0E003F349E /* Build configuration list for PBXNativeTarget "CWStatusBarNotification" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5E9AB6EB1B8F7A0E003F349E /* Debug */,
5E9AB6EC1B8F7A0E003F349E /* Release */,
);
defaultConfigurationIsVisible = 0;
};
/* End XCConfigurationList section */
};
rootObject = 5E9AB6D91B8F7A0E003F349E /* Project object */;
}
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -14,77 +14,61 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CE8882BD17EAD71900A6F491"
BuildableName = "CWStatusBarNotificationDemo.app"
BlueprintName = "CWStatusBarNotificationDemo"
ReferencedContainer = "container:CWStatusBarNotificationDemo.xcodeproj">
BlueprintIdentifier = "5E9AB6E11B8F7A0E003F349E"
BuildableName = "CWStatusBarNotification.framework"
BlueprintName = "CWStatusBarNotification"
ReferencedContainer = "container:CWStatusBarNotification.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<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>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CE8882BD17EAD71900A6F491"
BuildableName = "CWStatusBarNotificationDemo.app"
BlueprintName = "CWStatusBarNotificationDemo"
ReferencedContainer = "container:CWStatusBarNotificationDemo.xcodeproj">
BlueprintIdentifier = "5E9AB6E11B8F7A0E003F349E"
BuildableName = "CWStatusBarNotification.framework"
BlueprintName = "CWStatusBarNotification"
ReferencedContainer = "container:CWStatusBarNotification.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CE8882BD17EAD71900A6F491"
BuildableName = "CWStatusBarNotificationDemo.app"
BlueprintName = "CWStatusBarNotificationDemo"
ReferencedContainer = "container:CWStatusBarNotificationDemo.xcodeproj">
BlueprintIdentifier = "5E9AB6E11B8F7A0E003F349E"
BuildableName = "CWStatusBarNotification.framework"
BlueprintName = "CWStatusBarNotification"
ReferencedContainer = "container:CWStatusBarNotification.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
@@ -0,0 +1,19 @@
//
// CWStatusBarNotification.h
// CWStatusBarNotification
//
// Created by Cezary Wojcik on 8/27/15.
// Copyright © 2015 Cezary Wojcik. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for CWStatusBarNotification.
FOUNDATION_EXPORT double CWStatusBarNotificationVersionNumber;
//! Project version string for CWStatusBarNotification.
FOUNDATION_EXPORT const unsigned char CWStatusBarNotificationVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <CWStatusBarNotification/PublicHeader.h>
@@ -0,0 +1,526 @@
//
// CWStatusBarNotification.swift
// CWNotificationDemo
//
// Created by Cezary Wojcik on 7/12/15.
// Copyright © 2015 Cezary Wojcik. All rights reserved.
//
import UIKit
// MARK: - enums
@objc public enum CWNotificationStyle : Int {
case StatusBarNotification
case NavigationBarNotification
}
@objc public enum CWNotificationAnimationStyle : Int {
case Top
case Bottom
case Left
case Right
}
@objc public enum CWNotificationAnimationType : Int {
case Replace
case Overlay
}
// MARK: - CWStatusBarNotification
public class CWStatusBarNotification : NSObject {
// MARK: - properties
private let fontSize : CGFloat = 10.0
private var tapGestureRecognizer : UITapGestureRecognizer!
private var dismissHandle : CWDelayedClosureHandle?
private var isCustomView : Bool
public var notificationLabel : ScrollLabel?
public var statusBarView : UIView?
public var notificationTappedClosure : () -> ()
public var notificationIsShowing = false
public var notificationIsDismissing = false
public var notificationWindow : CWWindowContainer?
public var notificationLabelBackgroundColor : UIColor
public var notificationLabelTextColor : UIColor
public var notificationLabelFont : UIFont
public var notificationLabelHeight : CGFloat
public var customView : UIView?
public var multiline : Bool
public var supportedInterfaceOrientations : UIInterfaceOrientationMask
public var notificationAnimationDuration : NSTimeInterval
public var notificationStyle : CWNotificationStyle
public var notificationAnimationInStyle : CWNotificationAnimationStyle
public var notificationAnimationOutStyle : CWNotificationAnimationStyle
public var notificationAnimationType : CWNotificationAnimationType
public var preferredStatusBarStyle : UIStatusBarStyle
// MARK: - setup
public override init() {
if let tintColor = UIApplication.sharedApplication().delegate?.window??
.tintColor {
self.notificationLabelBackgroundColor = tintColor
} else {
self.notificationLabelBackgroundColor = UIColor.blackColor()
}
self.notificationLabelTextColor = UIColor.whiteColor()
self.notificationLabelFont = UIFont.systemFontOfSize(self.fontSize)
self.notificationLabelHeight = 0.0
self.customView = nil
self.multiline = false
if let supportedInterfaceOrientations = UIApplication
.sharedApplication().keyWindow?.rootViewController?
.supportedInterfaceOrientations() {
self.supportedInterfaceOrientations = supportedInterfaceOrientations
} else {
self.supportedInterfaceOrientations = .All
}
self.notificationAnimationDuration = 0.25
self.notificationStyle = .StatusBarNotification
self.notificationAnimationInStyle = .Bottom
self.notificationAnimationOutStyle = .Bottom
self.notificationAnimationType = .Replace
self.notificationIsDismissing = false
self.isCustomView = false
self.preferredStatusBarStyle = .Default
self.dismissHandle = nil
// make swift happy
self.notificationTappedClosure = {}
super.init()
// create default tap closure
self.notificationTappedClosure = {
if !self.notificationIsDismissing {
self.dismissNotification()
}
}
// create tap recognizer
self.tapGestureRecognizer = UITapGestureRecognizer(target: self,
action: #selector(CWStatusBarNotification.notificationTapped(_:)))
}
// MARK: - dimensions
private func getStatusBarHeight() -> CGFloat {
if self.notificationLabelHeight > 0 {
return self.notificationLabelHeight
}
var statusBarHeight = UIApplication.sharedApplication().statusBarFrame
.size.height
if systemVersionLessThan("8.0.0") && UIInterfaceOrientationIsLandscape(
UIApplication.sharedApplication().statusBarOrientation) {
statusBarHeight = UIApplication.sharedApplication().statusBarFrame
.size.width
}
return statusBarHeight > 0 ? statusBarHeight : 20
}
private func getStatusBarWidth() -> CGFloat {
if systemVersionLessThan("8.0.0") && UIInterfaceOrientationIsLandscape(
UIApplication.sharedApplication().statusBarOrientation) {
return UIScreen.mainScreen().bounds.size.height
}
return UIScreen.mainScreen().bounds.size.width
}
private func getStatusBarOffset() -> CGFloat {
if self.getStatusBarHeight() == 40.0 {
return -20.0
}
return 0.0
}
private func getNavigationBarHeight() -> CGFloat {
if UIInterfaceOrientationIsPortrait(UIApplication.sharedApplication()
.statusBarOrientation) || UI_USER_INTERFACE_IDIOM() == .Pad {
return 44.0
}
return 30.0
}
private func getNotificationLabelHeight() -> CGFloat {
switch self.notificationStyle {
case .NavigationBarNotification:
return self.getStatusBarHeight() + self.getNavigationBarHeight()
case .StatusBarNotification:
fallthrough
default:
return self.getStatusBarHeight()
}
}
private func getNotificationLabelTopFrame() -> CGRect {
return CGRectMake(0, self.getStatusBarOffset() + -1
* self.getNotificationLabelHeight(), self.getStatusBarWidth(),
self.getNotificationLabelHeight())
}
private func getNotificationLabelBottomFrame() -> CGRect {
return CGRectMake(0, self.getStatusBarOffset()
+ self.getNotificationLabelHeight(), self.getStatusBarWidth(), 0)
}
private func getNotificationLabelLeftFrame() -> CGRect {
return CGRectMake(-1 * self.getStatusBarWidth(),
self.getStatusBarOffset(), self.getStatusBarWidth(),
self.getNotificationLabelHeight())
}
private func getNotificationLabelRightFrame() -> CGRect {
return CGRectMake(self.getStatusBarWidth(), self.getStatusBarOffset(),
self.getStatusBarWidth(), self.getNotificationLabelHeight())
}
private func getNotificationLabelFrame() -> CGRect {
return CGRectMake(0, self.getStatusBarOffset(),
self.getStatusBarWidth(), self.getNotificationLabelHeight())
}
// MARK: - screen orientation change
func updateStatusBarFrame() {
if let view = self.isCustomView ? self.customView :
self.notificationLabel {
view.frame = self.getNotificationLabelFrame()
}
if let statusBarView = self.statusBarView {
statusBarView.hidden = true
}
}
// MARK: - on tap
func notificationTapped(recognizer : UITapGestureRecognizer) {
self.notificationTappedClosure()
}
// MARK: - display helpers
private func setupNotificationView(view : UIView) {
view.clipsToBounds = true
view.userInteractionEnabled = true
view.addGestureRecognizer(self.tapGestureRecognizer)
switch self.notificationAnimationInStyle {
case .Top:
view.frame = self.getNotificationLabelTopFrame()
case .Bottom:
view.frame = self.getNotificationLabelBottomFrame()
case .Left:
view.frame = self.getNotificationLabelLeftFrame()
case .Right:
view.frame = self.getNotificationLabelRightFrame()
}
}
private func createNotificationLabelWithMessage(message : String) {
self.notificationLabel = ScrollLabel()
self.notificationLabel?.numberOfLines = self.multiline ? 0 : 1
self.notificationLabel?.text = message
self.notificationLabel?.textAlignment = .Center
self.notificationLabel?.adjustsFontSizeToFitWidth = false
self.notificationLabel?.font = self.notificationLabelFont
self.notificationLabel?.backgroundColor =
self.notificationLabelBackgroundColor
self.notificationLabel?.textColor = self.notificationLabelTextColor
if self.notificationLabel != nil {
self.setupNotificationView(self.notificationLabel!)
}
}
private func createNotificationWithCustomView(view : UIView) {
self.customView = UIView()
// no autoresizing masks so that we can create constraints manually
view.translatesAutoresizingMaskIntoConstraints = false
self.customView?.addSubview(view)
// setup auto layout constraints so that the custom view that is added
// is constrained to be the same size as its superview, whose frame will
// be altered
self.customView?.addConstraint(NSLayoutConstraint(item: view,
attribute: .Trailing, relatedBy: .Equal, toItem: self.customView,
attribute: .Trailing, multiplier: 1.0, constant: 0.0))
self.customView?.addConstraint(NSLayoutConstraint(item: view,
attribute: .Leading, relatedBy: .Equal, toItem: self.customView,
attribute: .Leading, multiplier: 1.0, constant: 0.0))
self.customView?.addConstraint(NSLayoutConstraint(item: view,
attribute: .Top, relatedBy: .Equal, toItem: self.customView,
attribute: .Top, multiplier: 1.0, constant: 0.0))
self.customView?.addConstraint(NSLayoutConstraint(item: view,
attribute: .Bottom, relatedBy: .Equal, toItem: self.customView,
attribute: .Bottom, multiplier: 1.0, constant: 0.0))
if self.customView != nil {
self.setupNotificationView(self.customView!)
}
}
private func createNotificationWindow() {
self.notificationWindow = CWWindowContainer(
frame: UIScreen.mainScreen().bounds)
self.notificationWindow?.backgroundColor = UIColor.clearColor()
self.notificationWindow?.userInteractionEnabled = true
self.notificationWindow?.autoresizingMask = UIViewAutoresizing(
arrayLiteral: .FlexibleWidth, .FlexibleHeight)
self.notificationWindow?.windowLevel = UIWindowLevelStatusBar
let rootViewController = CWViewController()
rootViewController.localSupportedInterfaceOrientations =
self.supportedInterfaceOrientations
rootViewController.localPreferredStatusBarStyle =
self.preferredStatusBarStyle
self.notificationWindow?.rootViewController = rootViewController
self.notificationWindow?.notificationHeight =
self.getNotificationLabelHeight()
}
private func createStatusBarView() {
self.statusBarView = UIView(frame: self.getNotificationLabelFrame())
self.statusBarView?.clipsToBounds = true
if self.notificationAnimationType == .Replace {
let statusBarImageView = UIScreen.mainScreen()
.snapshotViewAfterScreenUpdates(true)
self.statusBarView?.addSubview(statusBarImageView)
}
if self.statusBarView != nil {
self.notificationWindow?.rootViewController?.view
.addSubview(self.statusBarView!)
self.notificationWindow?.rootViewController?.view
.sendSubviewToBack(self.statusBarView!)
}
}
// MARK: - frame changing
private func firstFrameChange() {
guard let view = self.isCustomView ? self.customView :
self.notificationLabel where self.statusBarView != nil else {
return
}
view.frame = self.getNotificationLabelFrame()
switch self.notificationAnimationInStyle {
case .Top:
self.statusBarView!.frame = self.getNotificationLabelBottomFrame()
case .Bottom:
self.statusBarView!.frame = self.getNotificationLabelTopFrame()
case .Left:
self.statusBarView!.frame = self.getNotificationLabelRightFrame()
case .Right:
self.statusBarView!.frame = self.getNotificationLabelLeftFrame()
}
}
private func secondFrameChange() {
guard let view = self.isCustomView ? self.customView :
self.notificationLabel where self.statusBarView != nil else {
return
}
switch self.notificationAnimationOutStyle {
case .Top:
self.statusBarView!.frame = self.getNotificationLabelBottomFrame()
case .Bottom:
self.statusBarView!.frame = self.getNotificationLabelTopFrame()
view.layer.anchorPoint = CGPointMake(0.5, 1.0)
view.center = CGPointMake(view.center.x, self.getStatusBarOffset()
+ self.getNotificationLabelHeight())
case .Left:
self.statusBarView!.frame = self.getNotificationLabelRightFrame()
case .Right:
self.statusBarView!.frame = self.getNotificationLabelLeftFrame()
}
}
private func thirdFrameChange() {
guard let view = self.isCustomView ? self.customView :
self.notificationLabel where self.statusBarView != nil else {
return
}
self.statusBarView!.frame = self.getNotificationLabelFrame()
switch self.notificationAnimationOutStyle {
case .Top:
view.frame = self.getNotificationLabelTopFrame()
case .Bottom:
view.transform = CGAffineTransformMakeScale(1.0, 0.01)
case .Left:
view.frame = self.getNotificationLabelLeftFrame()
case .Right:
view.frame = self.getNotificationLabelRightFrame()
}
}
// MARK: - display notification
public func displayNotificationWithMessage(message : String,
completion : () -> ()) {
guard !self.notificationIsShowing else {
return
}
self.isCustomView = false
self.notificationIsShowing = true
// create window
self.createNotificationWindow()
// create label
self.createNotificationLabelWithMessage(message)
// create status bar view
self.createStatusBarView()
// add label to window
guard let label = self.notificationLabel else {
return
}
self.notificationWindow?.rootViewController?.view.addSubview(label)
self.notificationWindow?.rootViewController?.view.bringSubviewToFront(
label)
self.notificationWindow?.hidden = false
// checking for screen orientation change
NSNotificationCenter.defaultCenter().addObserver(self,
selector: #selector(CWStatusBarNotification.updateStatusBarFrame),
name: UIApplicationDidChangeStatusBarFrameNotification,
object: nil)
// checking for status bar change
NSNotificationCenter.defaultCenter().addObserver(self,
selector: #selector(CWStatusBarNotification.updateStatusBarFrame),
name: UIApplicationWillChangeStatusBarFrameNotification,
object: nil)
// animate
UIView.animateWithDuration(self.notificationAnimationDuration,
animations: { () -> () in
self.firstFrameChange()
}) { (finished) -> () in
if let delayInSeconds = self.notificationLabel?.scrollTime() {
performClosureAfterDelay(Double(delayInSeconds), closure: {
() -> () in
completion()
})
}
}
}
public func displayNotificationWithMessage(message : String,
forDuration duration : NSTimeInterval) {
self.displayNotificationWithMessage(message) { () -> () in
self.dismissHandle = performClosureAfterDelay(duration, closure: {
() -> () in
self.dismissNotification()
})
}
}
public func displayNotificationWithAttributedString(
attributedString : NSAttributedString, completion : () -> ()) {
self.displayNotificationWithMessage(attributedString.string,
completion: completion)
self.notificationLabel?.attributedText = attributedString
}
public func displayNotificationWithAttributedString(
attributedString : NSAttributedString,
forDuration duration : NSTimeInterval) {
self.displayNotificationWithMessage(attributedString.string,
forDuration: duration)
self.notificationLabel?.attributedText = attributedString
}
public func displayNotificationWithView(view : UIView, completion : () -> ()) {
guard !self.notificationIsShowing else {
return
}
self.isCustomView = true
self.notificationIsShowing = true
// create window
self.createNotificationWindow()
// setup custom view
self.createNotificationWithCustomView(view)
// create status bar view
self.createStatusBarView()
// add view to window
if let rootView = self.notificationWindow?.rootViewController?.view,
let customView = self.customView {
rootView.addSubview(customView)
rootView.bringSubviewToFront(customView)
self.notificationWindow!.hidden = false
}
// checking for screen orientation change
NSNotificationCenter.defaultCenter().addObserver(self,
selector: #selector(CWStatusBarNotification.updateStatusBarFrame),
name: UIApplicationDidChangeStatusBarFrameNotification,
object: nil)
// checking for status bar change
NSNotificationCenter.defaultCenter().addObserver(self,
selector: #selector(CWStatusBarNotification.updateStatusBarFrame),
name: UIApplicationWillChangeStatusBarFrameNotification,
object: nil)
// animate
UIView.animateWithDuration(self.notificationAnimationDuration,
animations: { () -> () in
self.firstFrameChange()
}) { (finished) -> () in
completion()
}
}
public func displayNotificationWithView(view : UIView,
forDuration duration : NSTimeInterval) {
self.displayNotificationWithView(view) { () -> () in
self.dismissHandle = performClosureAfterDelay(duration, closure: { () -> Void in
self.dismissNotification()
})
}
}
public func dismissNotificationWithCompletion(completion : (() -> ())?) {
cancelDelayedClosure(self.dismissHandle)
self.notificationIsDismissing = true
self.secondFrameChange()
UIView.animateWithDuration(self.notificationAnimationDuration,
animations: { () -> () in
self.thirdFrameChange()
}) { (finished) -> () in
guard let view = self.isCustomView ? self.customView :
self.notificationLabel else {
return
}
view.removeFromSuperview()
self.statusBarView?.removeFromSuperview()
self.notificationWindow?.hidden = true
self.notificationWindow = nil
self.customView = nil
self.notificationLabel = nil
self.notificationIsShowing = false
self.notificationIsDismissing = false
NSNotificationCenter.defaultCenter().removeObserver(self,
name: UIApplicationDidChangeStatusBarFrameNotification,
object: nil)
NSNotificationCenter.defaultCenter().removeObserver(self,
name: UIApplicationWillChangeStatusBarFrameNotification,
object: nil)
if completion != nil {
completion!()
}
}
}
public func dismissNotification() {
self.dismissNotificationWithCompletion(nil)
}
}
@@ -0,0 +1,178 @@
//
// CWStatusBarNotificationUtils.swift
// CWNotificationDemo
//
// Created by Cezary Wojcik on 7/11/15.
// Copyright © 2015 Cezary Wojcik. All rights reserved.
//
import UIKit
// MARK: - helper functions
func systemVersionLessThan(value : String) -> Bool {
return UIDevice.currentDevice().systemVersion.compare(value,
options: NSStringCompareOptions.NumericSearch) == .OrderedAscending
}
// MARK: - ScrollLabel
public class ScrollLabel : UILabel {
// MARK: - properties
private let padding : CGFloat = 10.0
private let scrollSpeed : CGFloat = 40.0
private let scrollDelay : CGFloat = 1.0
private var textImage : UIImageView?
// MARK: - setup
override init(frame: CGRect) {
super.init(frame: frame)
self.textImage = UIImageView()
self.addSubview(self.textImage!)
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override public func drawTextInRect(rect: CGRect) {
guard self.scrollOffset() > 0 else {
self.textImage = nil
super.drawTextInRect(CGRectInset(rect, padding, 0))
return
}
guard let textImage = self.textImage else {
return
}
var frame = rect // because rect is immutable
frame.size.width = self.fullWidth() + padding * 2
UIGraphicsBeginImageContextWithOptions(frame.size, false,
UIScreen.mainScreen().scale)
super.drawTextInRect(frame)
textImage.image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
textImage.sizeToFit()
UIView.animateWithDuration(NSTimeInterval(self.scrollTime()
- scrollDelay),
delay: NSTimeInterval(scrollDelay),
options: UIViewAnimationOptions(arrayLiteral:
UIViewAnimationOptions.BeginFromCurrentState,
UIViewAnimationOptions.CurveEaseInOut),
animations: { () -> () in
textImage.transform = CGAffineTransformMakeTranslation(-1
* self.scrollOffset(), 0)
}, completion: nil)
}
// MARK - methods
private func fullWidth() -> CGFloat {
guard let content = self.text else {
return 0.0
}
let size = NSString(string: content).sizeWithAttributes(
[NSFontAttributeName: self.font])
return size.width
}
private func scrollOffset() -> CGFloat {
guard self.numberOfLines == 1 else {
return 0.0
}
let insetRect = CGRectInset(self.bounds, padding, 0.0)
return max(0, self.fullWidth() - insetRect.size.width)
}
func scrollTime() -> CGFloat {
return self.scrollOffset() > 0 ? self.scrollOffset() / scrollSpeed
+ scrollDelay : 0
}
}
// MARK: - CWWindowContainer
public class CWWindowContainer : UIWindow {
var notificationHeight : CGFloat = 0.0
override public func hitTest(pt: CGPoint, withEvent event: UIEvent?) -> UIView? {
var height : CGFloat = 0.0
if systemVersionLessThan("8.0.0") && UIInterfaceOrientationIsLandscape(
UIApplication.sharedApplication().statusBarOrientation) {
height = UIApplication.sharedApplication().statusBarFrame.size.width
} else {
height = UIApplication.sharedApplication().statusBarFrame.size
.height
}
if pt.y > 0 && pt.y < (self.notificationHeight != 0.0 ?
self.notificationHeight : height) {
return super.hitTest(pt, withEvent: event)
}
return nil
}
}
// MARK: - CWViewController
class CWViewController : UIViewController {
var localPreferredStatusBarStyle : UIStatusBarStyle = .Default
var localSupportedInterfaceOrientations : UIInterfaceOrientationMask = []
override func preferredStatusBarStyle() -> UIStatusBarStyle {
return self.localPreferredStatusBarStyle
}
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return self.localSupportedInterfaceOrientations
}
override func prefersStatusBarHidden() -> Bool {
let statusBarHeight = UIApplication.sharedApplication().statusBarFrame
.size.height
return !(statusBarHeight > 0)
}
}
// MARK: - delayed closure handle
typealias CWDelayedClosureHandle = (Bool) -> ()
func performClosureAfterDelay(seconds : Double, closure: dispatch_block_t?) -> CWDelayedClosureHandle? {
guard closure != nil else {
return nil
}
var closureToExecute : dispatch_block_t! = closure // copy?
var delayHandleCopy : CWDelayedClosureHandle! = nil
let delayHandle : CWDelayedClosureHandle = {
(cancel : Bool) -> () in
if !cancel && closureToExecute != nil {
dispatch_async(dispatch_get_main_queue(), closureToExecute)
}
closureToExecute = nil
delayHandleCopy = nil
}
delayHandleCopy = delayHandle
let delay = Int64(Double(seconds) * Double(NSEC_PER_SEC))
let after = dispatch_time(DISPATCH_TIME_NOW, delay)
dispatch_after(after, dispatch_get_main_queue()) {
if delayHandleCopy != nil {
delayHandleCopy(false)
}
}
return delayHandleCopy
}
func cancelDelayedClosure(delayedHandle : CWDelayedClosureHandle!) {
guard delayedHandle != nil else {
return
}
delayedHandle(true)
}
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
@@ -1,19 +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;
@end
@@ -1,126 +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_HEIGHT 22.0f
#define STATUS_BAR_ANIMATION_LENGTH 0.25f
#define FONT_SIZE 12.0f
NSString const *CWStatusBarIsHiddenKey = @"CWStatusBarIsHiddenKey";
NSString const *CWStatusBarNotificationIsShowingKey = @"CWStatusBarNotificationIsShowingKey";
NSString const *CWStatusBarNotificationLabelKey = @"CWStatusBarNotificationLabelKey";
# pragma mark - helper functions
// The below functions produce warnings - not an issue
- (BOOL)prefersStatusBarHidden {
return self.statusBarIsHidden;
}
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation {
return UIStatusBarAnimationSlide;
}
# pragma mark - dimensions
- (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*STATUS_BAR_HEIGHT, [self getStatusBarWidth], STATUS_BAR_HEIGHT);
}
- (CGRect)getStatusBarFrame {
return CGRectMake(0, 0, [self getStatusBarWidth], STATUS_BAR_HEIGHT);
}
# 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.view addSubview:self.statusBarNotificationLabel];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenOrientationChanged) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
[UIView animateWithDuration:STATUS_BAR_ANIMATION_LENGTH animations:^{
self.statusBarIsHidden = YES;
[self setNeedsStatusBarAppearanceUpdate];
self.statusBarNotificationLabel.frame = [self getStatusBarFrame];
} 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.statusBarIsHidden = NO;
[self setNeedsStatusBarAppearanceUpdate];
self.statusBarNotificationLabel.frame = [self getStatusBarHiddenFrame];
} completion:^(BOOL finished) {
[self.statusBarNotificationLabel removeFromSuperview];
self.statusBarNotificationIsShowing = NO;
[[NSNotificationCenter defaultCenter] removeObserver:self];
}];
});
}];
}];
}
}
- (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);
}
@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,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
-152
View File
@@ -1,152 +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];
self.window.rootViewController = sampleViewController;
[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,53 +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];
// 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,72 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4510" systemVersion="12E55" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<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,17 +0,0 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#endif
@@ -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,51 +0,0 @@
{
"images" : [
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"subtype" : "retina4",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -1,2 +0,0 @@
/* Localized versions of Info.plist keys */
-18
View File
@@ -1,18 +0,0 @@
//
// main.m
// CWStatusBarNotificationDemo
//
// Created by Cezary Wojcik on 9/18/13.
// Copyright (c) 2013 Cezary Wojcik. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CWAppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([CWAppDelegate class]));
}
}
+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
+90 -24
View File
@@ -1,55 +1,121 @@
# CWStatusBarNotification
# CWStatusBarNotification - Swift Branch
`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)
`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 Swift 2.0 and requires iOS 7.0+.
Works for iPhone and iPad.
## Installation
### CocoaPods
### Copy Files
*Coming Soon*
### Manual
Copy the folder `CWStatusBarNotification` to your project.
Copy the two `*.swift` files from `CWStatusBarNotification/CWStatusBarNotification/` into your project.
## Usage
Use the following import statement in the View Controller you wish to use this with:
You need to create a `CWStatusBarNotification` object. It is recommended that you do so by attaching it as a property to a view controller.
#import "UIViewController+CWStatusBarNotification.h"
```
let notification = CWStatusBarNotification()
```
Now, to trigger a notification:
After you have a `CWStatusBarNotification` object, you can simply call the `displayNotificationMessage(message: String, duration: NSTimeInterval)` method:
NSString *notificationText = @"This is a test notification";
CGFloat duration = 1.0f;
[self showStatusBarNotification:notificationText forDuration:duration];
```
self.notification.displayNotificationWithMessage("Hello, World!", duration: 1.0)
```
### Customization
If you prefer to manually choose when to display and dismiss the notification, you can do so as well:
The category adds a new property to `UIViewController` called `statusBarNotificationLabel`. Here is an example usage:
```
self.notification.displayNotificationWithMessage("Hello", completion: nil)
// wait until you need to dismiss
self.notification.dismissNotification()
```
self.statusBarNotificationLabel.textColor = [UIColor whiteColor];
self.statusBarNotificationLabel.backgroundColor = self.view.tintColor;
### Behavior on Tap
The default behavior when the notification is tapped is to dismiss it. However, you can override this behavior by setting the `notificationTappedClosure` closure to something different.
For example:
```
self.notification.notificationTappedClosure = {
println("notification tapped")
// more code here
}
```
Note that overriding this closure 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 closure:
```
self.notification.notificationTappedClosure = {
if !self.notificationIsDismissing {
self.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:
```
self.notification.notificationLabelBackgroundColor = UIColor.blackColor()
self.notification.notificationLabelTextColor = UIColor.greenColor()
```
![custom colors](screenshots/ss1.gif)
The default value of `notificationLabelBackgroundColor` is `UIColor.blackColor()`.
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 `CWNotificationStyle.StatusBarNotification` or `CWNotificationStyle.NavigationBarNotification`.
Example:
```
self.notification.notificationStyle = .NavigationBarNotification
```
![custom style](screenshots/ss2.gif)
The default value of `notificationStyle` is `CWNotificationStyle.StatusBarNotification`.
## 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:
* `CWNotificationAnimationStyle.Top`
* `CWNotificationAnimationStyle.Bottom`
* `CWNotificationAnimationStyle.Left`
* `CWNotificationAnimationStyle.Right`
The `notificationAnimationInStyle` describes where the notification comes from, whereas the `notificationAnimationOutStyle` describes where the notification will go.
The default value for `notificationAnimationInStyle` is `CWNotificationAnimationStyle.Bottom`.
The default value for `notificationAnimationOutStyle` is `CWNotificationAnimationStyle.Bottom`.
### 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) 2015 Cezary Wojcik <http://www.cezarywojcik.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 MiB

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