From 0b9f4ce44050ed31fedef79e5cbef39ee6ff121a Mon Sep 17 00:00:00 2001 From: Graham Haworth Date: Mon, 16 Apr 2012 10:38:16 -0500 Subject: [PATCH 1/8] Reorganized into static library and demo projects. --- .gitignore | 1 + {InfoBar => Code/Demo}/FirstViewController.h | 0 {InfoBar => Code/Demo}/FirstViewController.m | 0 {InfoBar => Code/Demo}/InfoBarAppDelegate.h | 0 {InfoBar => Code/Demo}/InfoBarAppDelegate.m | 0 .../Demo/InfoBarDemo-Info.plist | 0 .../Demo/InfoBarDemo-Prefix.pch | 0 {InfoBar => Code/Demo}/SecondViewController.h | 0 {InfoBar => Code/Demo}/SecondViewController.m | 0 {InfoBar => Code/Demo}/en.lproj/FirstView.xib | 0 .../Demo}/en.lproj/InfoPlist.strings | 0 .../Demo}/en.lproj/MainWindow.xib | 0 .../Demo}/en.lproj/SecondView.xib | 0 {InfoBar => Code/Demo}/main.m | 0 Code/Library/InfoBarStaticLibrary-Prefix.pch | 7 + {InfoBar => Code/Library}/JBInfoBar.h | 0 {InfoBar => Code/Library}/JBInfoBar.m | 0 {InfoBar => Code/Library}/JBInfoBarManager.h | 0 {InfoBar => Code/Library}/JBInfoBarManager.m | 0 InfoBar.xcodeproj/project.pbxproj | 333 +++++++++++++----- README => README.md | 0 Icon.png => Resources/Icon.png | Bin Icon@2x.png => Resources/Icon@2x.png | Bin 23 files changed, 245 insertions(+), 96 deletions(-) rename {InfoBar => Code/Demo}/FirstViewController.h (100%) rename {InfoBar => Code/Demo}/FirstViewController.m (100%) rename {InfoBar => Code/Demo}/InfoBarAppDelegate.h (100%) rename {InfoBar => Code/Demo}/InfoBarAppDelegate.m (100%) rename InfoBar/InfoBar-Info.plist => Code/Demo/InfoBarDemo-Info.plist (100%) rename InfoBar/InfoBar-Prefix.pch => Code/Demo/InfoBarDemo-Prefix.pch (100%) rename {InfoBar => Code/Demo}/SecondViewController.h (100%) rename {InfoBar => Code/Demo}/SecondViewController.m (100%) rename {InfoBar => Code/Demo}/en.lproj/FirstView.xib (100%) rename {InfoBar => Code/Demo}/en.lproj/InfoPlist.strings (100%) rename {InfoBar => Code/Demo}/en.lproj/MainWindow.xib (100%) rename {InfoBar => Code/Demo}/en.lproj/SecondView.xib (100%) rename {InfoBar => Code/Demo}/main.m (100%) create mode 100644 Code/Library/InfoBarStaticLibrary-Prefix.pch rename {InfoBar => Code/Library}/JBInfoBar.h (100%) rename {InfoBar => Code/Library}/JBInfoBar.m (100%) rename {InfoBar => Code/Library}/JBInfoBarManager.h (100%) rename {InfoBar => Code/Library}/JBInfoBarManager.m (100%) rename README => README.md (100%) rename Icon.png => Resources/Icon.png (100%) rename Icon@2x.png => Resources/Icon@2x.png (100%) diff --git a/.gitignore b/.gitignore index c4dd027..99a3f88 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # osx noise .DS_Store +._* # xcode noise build/* diff --git a/InfoBar/FirstViewController.h b/Code/Demo/FirstViewController.h similarity index 100% rename from InfoBar/FirstViewController.h rename to Code/Demo/FirstViewController.h diff --git a/InfoBar/FirstViewController.m b/Code/Demo/FirstViewController.m similarity index 100% rename from InfoBar/FirstViewController.m rename to Code/Demo/FirstViewController.m diff --git a/InfoBar/InfoBarAppDelegate.h b/Code/Demo/InfoBarAppDelegate.h similarity index 100% rename from InfoBar/InfoBarAppDelegate.h rename to Code/Demo/InfoBarAppDelegate.h diff --git a/InfoBar/InfoBarAppDelegate.m b/Code/Demo/InfoBarAppDelegate.m similarity index 100% rename from InfoBar/InfoBarAppDelegate.m rename to Code/Demo/InfoBarAppDelegate.m diff --git a/InfoBar/InfoBar-Info.plist b/Code/Demo/InfoBarDemo-Info.plist similarity index 100% rename from InfoBar/InfoBar-Info.plist rename to Code/Demo/InfoBarDemo-Info.plist diff --git a/InfoBar/InfoBar-Prefix.pch b/Code/Demo/InfoBarDemo-Prefix.pch similarity index 100% rename from InfoBar/InfoBar-Prefix.pch rename to Code/Demo/InfoBarDemo-Prefix.pch diff --git a/InfoBar/SecondViewController.h b/Code/Demo/SecondViewController.h similarity index 100% rename from InfoBar/SecondViewController.h rename to Code/Demo/SecondViewController.h diff --git a/InfoBar/SecondViewController.m b/Code/Demo/SecondViewController.m similarity index 100% rename from InfoBar/SecondViewController.m rename to Code/Demo/SecondViewController.m diff --git a/InfoBar/en.lproj/FirstView.xib b/Code/Demo/en.lproj/FirstView.xib similarity index 100% rename from InfoBar/en.lproj/FirstView.xib rename to Code/Demo/en.lproj/FirstView.xib diff --git a/InfoBar/en.lproj/InfoPlist.strings b/Code/Demo/en.lproj/InfoPlist.strings similarity index 100% rename from InfoBar/en.lproj/InfoPlist.strings rename to Code/Demo/en.lproj/InfoPlist.strings diff --git a/InfoBar/en.lproj/MainWindow.xib b/Code/Demo/en.lproj/MainWindow.xib similarity index 100% rename from InfoBar/en.lproj/MainWindow.xib rename to Code/Demo/en.lproj/MainWindow.xib diff --git a/InfoBar/en.lproj/SecondView.xib b/Code/Demo/en.lproj/SecondView.xib similarity index 100% rename from InfoBar/en.lproj/SecondView.xib rename to Code/Demo/en.lproj/SecondView.xib diff --git a/InfoBar/main.m b/Code/Demo/main.m similarity index 100% rename from InfoBar/main.m rename to Code/Demo/main.m diff --git a/Code/Library/InfoBarStaticLibrary-Prefix.pch b/Code/Library/InfoBarStaticLibrary-Prefix.pch new file mode 100644 index 0000000..849e75c --- /dev/null +++ b/Code/Library/InfoBarStaticLibrary-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'InfoBarStaticLibrary' target in the 'InfoBarStaticLibrary' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/InfoBar/JBInfoBar.h b/Code/Library/JBInfoBar.h similarity index 100% rename from InfoBar/JBInfoBar.h rename to Code/Library/JBInfoBar.h diff --git a/InfoBar/JBInfoBar.m b/Code/Library/JBInfoBar.m similarity index 100% rename from InfoBar/JBInfoBar.m rename to Code/Library/JBInfoBar.m diff --git a/InfoBar/JBInfoBarManager.h b/Code/Library/JBInfoBarManager.h similarity index 100% rename from InfoBar/JBInfoBarManager.h rename to Code/Library/JBInfoBarManager.h diff --git a/InfoBar/JBInfoBarManager.m b/Code/Library/JBInfoBarManager.m similarity index 100% rename from InfoBar/JBInfoBarManager.m rename to Code/Library/JBInfoBarManager.m diff --git a/InfoBar.xcodeproj/project.pbxproj b/InfoBar.xcodeproj/project.pbxproj index d4e9150..5068398 100644 --- a/InfoBar.xcodeproj/project.pbxproj +++ b/InfoBar.xcodeproj/project.pbxproj @@ -10,44 +10,62 @@ 5B5FB2811311514600719F62 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B5FB2801311514600719F62 /* UIKit.framework */; }; 5B5FB2831311514600719F62 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B5FB2821311514600719F62 /* Foundation.framework */; }; 5B5FB2851311514600719F62 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B5FB2841311514600719F62 /* CoreGraphics.framework */; }; - 5B5FB28B1311514600719F62 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5B5FB2891311514600719F62 /* InfoPlist.strings */; }; - 5B5FB28E1311514600719F62 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B5FB28D1311514600719F62 /* main.m */; }; - 5B5FB2911311514600719F62 /* InfoBarAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B5FB2901311514600719F62 /* InfoBarAppDelegate.m */; }; - 5B5FB2941311514600719F62 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B5FB2921311514600719F62 /* MainWindow.xib */; }; - 5B5FB2971311514600719F62 /* FirstViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B5FB2961311514600719F62 /* FirstViewController.m */; }; - 5B5FB29A1311514600719F62 /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B5FB2991311514600719F62 /* SecondViewController.m */; }; - 5B5FB29D1311514600719F62 /* FirstView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B5FB29B1311514600719F62 /* FirstView.xib */; }; - 5B5FB2A01311514600719F62 /* SecondView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B5FB29E1311514600719F62 /* SecondView.xib */; }; - 5B7A0B851311522400FE6193 /* JBInfoBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B7A0B841311522400FE6193 /* JBInfoBar.m */; }; - 5B7A0B8D131153F900FE6193 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 5B7A0B8C131153F900FE6193 /* Icon@2x.png */; }; - 5B7A0B8F1311540100FE6193 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 5B7A0B8E1311540100FE6193 /* Icon.png */; }; - 79438EEB131E5A880057CEAB /* JBInfoBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 79438EEA131E5A880057CEAB /* JBInfoBarManager.m */; }; + BF7B4635153C6E1E00616962 /* FirstViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4620153C6E1E00616962 /* FirstViewController.m */; }; + BF7B4637153C6E1E00616962 /* InfoBarAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4624153C6E1E00616962 /* InfoBarAppDelegate.m */; }; + BF7B4638153C6E1E00616962 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4625153C6E1E00616962 /* main.m */; }; + BF7B4639153C6E1E00616962 /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4627153C6E1E00616962 /* SecondViewController.m */; }; + BF7B463A153C6E1E00616962 /* FirstView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF7B4628153C6E1E00616962 /* FirstView.xib */; }; + BF7B463B153C6E1E00616962 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = BF7B462A153C6E1E00616962 /* InfoPlist.strings */; }; + BF7B463C153C6E1E00616962 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF7B462C153C6E1E00616962 /* MainWindow.xib */; }; + BF7B463D153C6E1E00616962 /* SecondView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF7B462E153C6E1E00616962 /* SecondView.xib */; }; + BF7B463E153C6E1E00616962 /* JBInfoBar.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4632153C6E1E00616962 /* JBInfoBar.m */; }; + BF7B463F153C6E1E00616962 /* JBInfoBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4634153C6E1E00616962 /* JBInfoBarManager.m */; }; + BF7B4647153C6EF300616962 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B5FB2821311514600719F62 /* Foundation.framework */; }; + BF7B4657153C6FC600616962 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = BF7B4655153C6FC600616962 /* Icon.png */; }; + BF7B4658153C6FC600616962 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = BF7B4656153C6FC600616962 /* Icon@2x.png */; }; + BF7B465E153C702900616962 /* libInfoBarStaticLibrary.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BF7B4646153C6EF300616962 /* libInfoBarStaticLibrary.a */; }; + BF7B4661153C734700616962 /* JBInfoBar.h in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4631153C6E1E00616962 /* JBInfoBar.h */; }; + BF7B4662153C734700616962 /* JBInfoBar.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4632153C6E1E00616962 /* JBInfoBar.m */; }; + BF7B4663153C734700616962 /* JBInfoBarManager.h in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4633153C6E1E00616962 /* JBInfoBarManager.h */; }; + BF7B4664153C734700616962 /* JBInfoBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4634153C6E1E00616962 /* JBInfoBarManager.m */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + BF7B465F153C708800616962 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5B5FB2731311514600719F62 /* Project object */; + proxyType = 1; + remoteGlobalIDString = BF7B4645153C6EF300616962; + remoteInfo = InfoBarStaticLibrary; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ - 5B5FB27C1311514600719F62 /* InfoBar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InfoBar.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 5B5FB27C1311514600719F62 /* InfoBarDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InfoBarDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5B5FB2801311514600719F62 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 5B5FB2821311514600719F62 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 5B5FB2841311514600719F62 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 5B5FB2881311514600719F62 /* InfoBar-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "InfoBar-Info.plist"; sourceTree = ""; }; - 5B5FB28A1311514600719F62 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 5B5FB28C1311514600719F62 /* InfoBar-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "InfoBar-Prefix.pch"; sourceTree = ""; }; - 5B5FB28D1311514600719F62 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 5B5FB28F1311514600719F62 /* InfoBarAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoBarAppDelegate.h; sourceTree = ""; }; - 5B5FB2901311514600719F62 /* InfoBarAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InfoBarAppDelegate.m; sourceTree = ""; }; - 5B5FB2931311514600719F62 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; - 5B5FB2951311514600719F62 /* FirstViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FirstViewController.h; sourceTree = ""; }; - 5B5FB2961311514600719F62 /* FirstViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FirstViewController.m; sourceTree = ""; }; - 5B5FB2981311514600719F62 /* SecondViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = ""; }; - 5B5FB2991311514600719F62 /* SecondViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = ""; }; - 5B5FB29C1311514600719F62 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/FirstView.xib; sourceTree = ""; }; - 5B5FB29F1311514600719F62 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/SecondView.xib; sourceTree = ""; }; - 5B7A0B831311522400FE6193 /* JBInfoBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JBInfoBar.h; sourceTree = ""; }; - 5B7A0B841311522400FE6193 /* JBInfoBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JBInfoBar.m; sourceTree = ""; }; - 5B7A0B8C131153F900FE6193 /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon@2x.png"; path = "../Icon@2x.png"; sourceTree = ""; }; - 5B7A0B8E1311540100FE6193 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon.png; path = ../Icon.png; sourceTree = ""; }; - 79438EE9131E5A880057CEAB /* JBInfoBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JBInfoBarManager.h; sourceTree = ""; }; - 79438EEA131E5A880057CEAB /* JBInfoBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JBInfoBarManager.m; sourceTree = ""; }; + BF7B461F153C6E1E00616962 /* FirstViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FirstViewController.h; sourceTree = ""; }; + BF7B4620153C6E1E00616962 /* FirstViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FirstViewController.m; sourceTree = ""; }; + BF7B4621153C6E1E00616962 /* InfoBarDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "InfoBarDemo-Info.plist"; sourceTree = ""; }; + BF7B4622153C6E1E00616962 /* InfoBarDemo-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "InfoBarDemo-Prefix.pch"; sourceTree = ""; }; + BF7B4623153C6E1E00616962 /* InfoBarAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InfoBarAppDelegate.h; sourceTree = ""; }; + BF7B4624153C6E1E00616962 /* InfoBarAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InfoBarAppDelegate.m; sourceTree = ""; }; + BF7B4625153C6E1E00616962 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + BF7B4626153C6E1E00616962 /* SecondViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = ""; }; + BF7B4627153C6E1E00616962 /* SecondViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = ""; }; + BF7B4629153C6E1E00616962 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/FirstView.xib; sourceTree = ""; }; + BF7B462B153C6E1E00616962 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + BF7B462D153C6E1E00616962 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; + BF7B462F153C6E1E00616962 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/SecondView.xib; sourceTree = ""; }; + BF7B4631153C6E1E00616962 /* JBInfoBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JBInfoBar.h; sourceTree = ""; }; + BF7B4632153C6E1E00616962 /* JBInfoBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JBInfoBar.m; sourceTree = ""; }; + BF7B4633153C6E1E00616962 /* JBInfoBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JBInfoBarManager.h; sourceTree = ""; }; + BF7B4634153C6E1E00616962 /* JBInfoBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JBInfoBarManager.m; sourceTree = ""; }; + BF7B4646153C6EF300616962 /* libInfoBarStaticLibrary.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libInfoBarStaticLibrary.a; sourceTree = BUILT_PRODUCTS_DIR; }; + BF7B4652153C6F6600616962 /* InfoBarStaticLibrary-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "InfoBarStaticLibrary-Prefix.pch"; sourceTree = ""; }; + BF7B4655153C6FC600616962 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; + BF7B4656153C6FC600616962 /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -55,19 +73,29 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + BF7B465E153C702900616962 /* libInfoBarStaticLibrary.a in Frameworks */, 5B5FB2811311514600719F62 /* UIKit.framework in Frameworks */, 5B5FB2831311514600719F62 /* Foundation.framework in Frameworks */, 5B5FB2851311514600719F62 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; + BF7B4643153C6EF300616962 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + BF7B4647153C6EF300616962 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 5B5FB2711311514600719F62 = { isa = PBXGroup; children = ( - 5B5FB2861311514600719F62 /* InfoBar */, + BF7B461D153C6E1E00616962 /* Code */, + BF7B4654153C6FC600616962 /* Resources */, 5B5FB27F1311514600719F62 /* Frameworks */, 5B5FB27D1311514600719F62 /* Products */, ); @@ -76,7 +104,8 @@ 5B5FB27D1311514600719F62 /* Products */ = { isa = PBXGroup; children = ( - 5B5FB27C1311514600719F62 /* InfoBar.app */, + 5B5FB27C1311514600719F62 /* InfoBarDemo.app */, + BF7B4646153C6EF300616962 /* libInfoBarStaticLibrary.a */, ); name = Products; sourceTree = ""; @@ -91,54 +120,88 @@ name = Frameworks; sourceTree = ""; }; - 5B5FB2861311514600719F62 /* InfoBar */ = { + BF7B461D153C6E1E00616962 /* Code */ = { + isa = PBXGroup; + children = ( + BF7B4630153C6E1E00616962 /* Library */, + BF7B461E153C6E1E00616962 /* Demo */, + ); + path = Code; + sourceTree = ""; + }; + BF7B461E153C6E1E00616962 /* Demo */ = { + isa = PBXGroup; + children = ( + BF7B4623153C6E1E00616962 /* InfoBarAppDelegate.h */, + BF7B4624153C6E1E00616962 /* InfoBarAppDelegate.m */, + BF7B461F153C6E1E00616962 /* FirstViewController.h */, + BF7B4620153C6E1E00616962 /* FirstViewController.m */, + BF7B4626153C6E1E00616962 /* SecondViewController.h */, + BF7B4627153C6E1E00616962 /* SecondViewController.m */, + BF7B4628153C6E1E00616962 /* FirstView.xib */, + BF7B462C153C6E1E00616962 /* MainWindow.xib */, + BF7B462E153C6E1E00616962 /* SecondView.xib */, + BF7B4641153C6EAB00616962 /* Supporting Files */, + ); + path = Demo; + sourceTree = ""; + }; + BF7B4630153C6E1E00616962 /* Library */ = { isa = PBXGroup; children = ( - 5B7A0B81131151E800FE6193 /* InfoBarView */, - 5B5FB28F1311514600719F62 /* InfoBarAppDelegate.h */, - 5B5FB2901311514600719F62 /* InfoBarAppDelegate.m */, - 5B5FB2921311514600719F62 /* MainWindow.xib */, - 5B5FB2951311514600719F62 /* FirstViewController.h */, - 5B5FB2961311514600719F62 /* FirstViewController.m */, - 5B5FB2981311514600719F62 /* SecondViewController.h */, - 5B5FB2991311514600719F62 /* SecondViewController.m */, - 5B5FB29B1311514600719F62 /* FirstView.xib */, - 5B5FB29E1311514600719F62 /* SecondView.xib */, - 5B5FB2871311514600719F62 /* Supporting Files */, + BF7B4631153C6E1E00616962 /* JBInfoBar.h */, + BF7B4632153C6E1E00616962 /* JBInfoBar.m */, + BF7B4633153C6E1E00616962 /* JBInfoBarManager.h */, + BF7B4634153C6E1E00616962 /* JBInfoBarManager.m */, + BF7B4653153C6F6B00616962 /* Supporting Files */, ); - path = InfoBar; + path = Library; sourceTree = ""; }; - 5B5FB2871311514600719F62 /* Supporting Files */ = { + BF7B4641153C6EAB00616962 /* Supporting Files */ = { isa = PBXGroup; children = ( - 5B7A0B8E1311540100FE6193 /* Icon.png */, - 5B7A0B8C131153F900FE6193 /* Icon@2x.png */, - 5B5FB2881311514600719F62 /* InfoBar-Info.plist */, - 5B5FB2891311514600719F62 /* InfoPlist.strings */, - 5B5FB28C1311514600719F62 /* InfoBar-Prefix.pch */, - 5B5FB28D1311514600719F62 /* main.m */, + BF7B4621153C6E1E00616962 /* InfoBarDemo-Info.plist */, + BF7B4622153C6E1E00616962 /* InfoBarDemo-Prefix.pch */, + BF7B462A153C6E1E00616962 /* InfoPlist.strings */, + BF7B4625153C6E1E00616962 /* main.m */, ); name = "Supporting Files"; sourceTree = ""; }; - 5B7A0B81131151E800FE6193 /* InfoBarView */ = { + BF7B4653153C6F6B00616962 /* Supporting Files */ = { isa = PBXGroup; children = ( - 5B7A0B831311522400FE6193 /* JBInfoBar.h */, - 5B7A0B841311522400FE6193 /* JBInfoBar.m */, - 79438EE9131E5A880057CEAB /* JBInfoBarManager.h */, - 79438EEA131E5A880057CEAB /* JBInfoBarManager.m */, + BF7B4652153C6F6600616962 /* InfoBarStaticLibrary-Prefix.pch */, ); - name = InfoBarView; + name = "Supporting Files"; + sourceTree = ""; + }; + BF7B4654153C6FC600616962 /* Resources */ = { + isa = PBXGroup; + children = ( + BF7B4655153C6FC600616962 /* Icon.png */, + BF7B4656153C6FC600616962 /* Icon@2x.png */, + ); + path = Resources; sourceTree = ""; }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + BF7B4644153C6EF300616962 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ - 5B5FB27B1311514600719F62 /* InfoBar */ = { + 5B5FB27B1311514600719F62 /* InfoBarDemo */ = { isa = PBXNativeTarget; - buildConfigurationList = 5B5FB2A31311514600719F62 /* Build configuration list for PBXNativeTarget "InfoBar" */; + buildConfigurationList = 5B5FB2A31311514600719F62 /* Build configuration list for PBXNativeTarget "InfoBarDemo" */; buildPhases = ( 5B5FB2781311514600719F62 /* Sources */, 5B5FB2791311514600719F62 /* Frameworks */, @@ -147,12 +210,30 @@ buildRules = ( ); dependencies = ( + BF7B4660153C708800616962 /* PBXTargetDependency */, ); - name = InfoBar; + name = InfoBarDemo; productName = InfoBar; - productReference = 5B5FB27C1311514600719F62 /* InfoBar.app */; + productReference = 5B5FB27C1311514600719F62 /* InfoBarDemo.app */; productType = "com.apple.product-type.application"; }; + BF7B4645153C6EF300616962 /* InfoBarStaticLibrary */ = { + isa = PBXNativeTarget; + buildConfigurationList = BF7B464E153C6EF300616962 /* Build configuration list for PBXNativeTarget "InfoBarStaticLibrary" */; + buildPhases = ( + BF7B4642153C6EF300616962 /* Sources */, + BF7B4643153C6EF300616962 /* Frameworks */, + BF7B4644153C6EF300616962 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = InfoBarStaticLibrary; + productName = InfoBarStaticLibrary; + productReference = BF7B4646153C6EF300616962 /* libInfoBarStaticLibrary.a */; + productType = "com.apple.product-type.library.static"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -170,7 +251,8 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 5B5FB27B1311514600719F62 /* InfoBar */, + BF7B4645153C6EF300616962 /* InfoBarStaticLibrary */, + 5B5FB27B1311514600719F62 /* InfoBarDemo */, ); }; /* End PBXProject section */ @@ -180,12 +262,12 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 5B5FB28B1311514600719F62 /* InfoPlist.strings in Resources */, - 5B5FB2941311514600719F62 /* MainWindow.xib in Resources */, - 5B5FB29D1311514600719F62 /* FirstView.xib in Resources */, - 5B5FB2A01311514600719F62 /* SecondView.xib in Resources */, - 5B7A0B8D131153F900FE6193 /* Icon@2x.png in Resources */, - 5B7A0B8F1311540100FE6193 /* Icon.png in Resources */, + BF7B463A153C6E1E00616962 /* FirstView.xib in Resources */, + BF7B463B153C6E1E00616962 /* InfoPlist.strings in Resources */, + BF7B463C153C6E1E00616962 /* MainWindow.xib in Resources */, + BF7B463D153C6E1E00616962 /* SecondView.xib in Resources */, + BF7B4657153C6FC600616962 /* Icon.png in Resources */, + BF7B4658153C6FC600616962 /* Icon@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -196,46 +278,65 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 5B5FB28E1311514600719F62 /* main.m in Sources */, - 5B5FB2911311514600719F62 /* InfoBarAppDelegate.m in Sources */, - 5B5FB2971311514600719F62 /* FirstViewController.m in Sources */, - 5B5FB29A1311514600719F62 /* SecondViewController.m in Sources */, - 5B7A0B851311522400FE6193 /* JBInfoBar.m in Sources */, - 79438EEB131E5A880057CEAB /* JBInfoBarManager.m in Sources */, + BF7B4635153C6E1E00616962 /* FirstViewController.m in Sources */, + BF7B4637153C6E1E00616962 /* InfoBarAppDelegate.m in Sources */, + BF7B4638153C6E1E00616962 /* main.m in Sources */, + BF7B4639153C6E1E00616962 /* SecondViewController.m in Sources */, + BF7B463E153C6E1E00616962 /* JBInfoBar.m in Sources */, + BF7B463F153C6E1E00616962 /* JBInfoBarManager.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BF7B4642153C6EF300616962 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BF7B4661153C734700616962 /* JBInfoBar.h in Sources */, + BF7B4662153C734700616962 /* JBInfoBar.m in Sources */, + BF7B4663153C734700616962 /* JBInfoBarManager.h in Sources */, + BF7B4664153C734700616962 /* JBInfoBarManager.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + BF7B4660153C708800616962 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = BF7B4645153C6EF300616962 /* InfoBarStaticLibrary */; + targetProxy = BF7B465F153C708800616962 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ - 5B5FB2891311514600719F62 /* InfoPlist.strings */ = { + BF7B4628153C6E1E00616962 /* FirstView.xib */ = { isa = PBXVariantGroup; children = ( - 5B5FB28A1311514600719F62 /* en */, + BF7B4629153C6E1E00616962 /* en */, ); - name = InfoPlist.strings; + name = FirstView.xib; sourceTree = ""; }; - 5B5FB2921311514600719F62 /* MainWindow.xib */ = { + BF7B462A153C6E1E00616962 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 5B5FB2931311514600719F62 /* en */, + BF7B462B153C6E1E00616962 /* en */, ); - name = MainWindow.xib; + name = InfoPlist.strings; sourceTree = ""; }; - 5B5FB29B1311514600719F62 /* FirstView.xib */ = { + BF7B462C153C6E1E00616962 /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( - 5B5FB29C1311514600719F62 /* en */, + BF7B462D153C6E1E00616962 /* en */, ); - name = FirstView.xib; + name = MainWindow.xib; sourceTree = ""; }; - 5B5FB29E1311514600719F62 /* SecondView.xib */ = { + BF7B462E153C6E1E00616962 /* SecondView.xib */ = { isa = PBXVariantGroup; children = ( - 5B5FB29F1311514600719F62 /* en */, + BF7B462F153C6E1E00616962 /* en */, ); name = SecondView.xib; sourceTree = ""; @@ -250,7 +351,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = DEBUG; + GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -281,9 +382,8 @@ COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "InfoBar/InfoBar-Prefix.pch"; - INFOPLIST_FILE = "InfoBar/InfoBar-Info.plist"; - INSTALL_PATH = "$(LOCAL_APPS_DIR)"; + GCC_PREFIX_HEADER = "Code/Demo/InfoBarDemo-Prefix.pch"; + INFOPLIST_FILE = "Code/Demo/InfoBarDemo-Info.plist"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -295,15 +395,47 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "InfoBar/InfoBar-Prefix.pch"; - INFOPLIST_FILE = "InfoBar/InfoBar-Info.plist"; - INSTALL_PATH = "$(LOCAL_APPS_DIR)"; + GCC_PREFIX_HEADER = "Code/Demo/InfoBarDemo-Prefix.pch"; + INFOPLIST_FILE = "Code/Demo/InfoBarDemo-Info.plist"; PRODUCT_NAME = "$(TARGET_NAME)"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; + BF7B464F153C6EF300616962 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + DSTROOT = /tmp/InfoBarStaticLibrary.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Code/Library/InfoBarStaticLibrary-Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + BF7B4650153C6EF300616962 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DSTROOT = /tmp/InfoBarStaticLibrary.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Code/Library/InfoBarStaticLibrary-Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -316,7 +448,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 5B5FB2A31311514600719F62 /* Build configuration list for PBXNativeTarget "InfoBar" */ = { + 5B5FB2A31311514600719F62 /* Build configuration list for PBXNativeTarget "InfoBarDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 5B5FB2A41311514600719F62 /* Debug */, @@ -325,6 +457,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + BF7B464E153C6EF300616962 /* Build configuration list for PBXNativeTarget "InfoBarStaticLibrary" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BF7B464F153C6EF300616962 /* Debug */, + BF7B4650153C6EF300616962 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 5B5FB2731311514600719F62 /* Project object */; diff --git a/README b/README.md similarity index 100% rename from README rename to README.md diff --git a/Icon.png b/Resources/Icon.png similarity index 100% rename from Icon.png rename to Resources/Icon.png diff --git a/Icon@2x.png b/Resources/Icon@2x.png similarity index 100% rename from Icon@2x.png rename to Resources/Icon@2x.png From dd5838943b41e4461b83145fa8f1bb7fcdbf8e3f Mon Sep 17 00:00:00 2001 From: Graham Haworth Date: Mon, 16 Apr 2012 10:40:24 -0500 Subject: [PATCH 2/8] Fixed up README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aa018ef..3cc3afd 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ -=== INFO === +INFO +==== InfoBar is a simple bar useful in apps that have tasks that run in backgrouns (like file download or updates). The goal is showing messages above the TabBar in an asynchronous way. To implement the InfoBar please copy JBInfoBar.h and JBInfoBar.m and add it to the delegate. -=== LICENSE === +LICENSE +======= InfoBar is released under MIT License Copyright (c) 2011 Junior B. - ThinkDiff.ch From ddeae354087e8003daf7b9807b8ac65e89b480b6 Mon Sep 17 00:00:00 2001 From: Graham Haworth Date: Mon, 16 Apr 2012 11:53:09 -0500 Subject: [PATCH 3/8] Refactored the JBInfoBar: - Delegates properties to owned objects where possible - Removed several parameters from the init method and changed to use several default values; the changed parameters can now be accessed as properties - Changed changed "isHidden" property to be "visible" so that it doesn't confuse/conflict with super-property "hidden" --- Code/Library/JBInfoBar.h | 29 ++-- Code/Library/JBInfoBar.m | 219 +++++++++++++++++++----------- InfoBar.xcodeproj/project.pbxproj | 4 +- 3 files changed, 156 insertions(+), 96 deletions(-) diff --git a/Code/Library/JBInfoBar.h b/Code/Library/JBInfoBar.h index e7fc52b..b6ae475 100644 --- a/Code/Library/JBInfoBar.h +++ b/Code/Library/JBInfoBar.h @@ -13,24 +13,29 @@ CGPoint hiddenCP; CGPoint showCP; - BOOL isHidden; - +@private UILabel *infoLabel; } -@property (nonatomic,assign) NSTimeInterval hideAnimationDelay; -@property (nonatomic,assign) NSTimeInterval hideAnimationDuration; -@property (nonatomic,assign) NSTimeInterval showAnimationDuration; -@property (readonly,assign) BOOL isHidden; -- (id)initWithFrame:(CGRect)frame - backgroundColor:(UIColor *)bColor - textColor:(UIColor *)tColor - textFont:(UIFont *)tFont; +- (id)initWithFrame:(CGRect)frame; + - (void)showBarWithMessage:(NSString *)message; - (void)hideBarWithMessage:(NSString *)message; - (void)hideBarImmediately; -- (void)setMessage:(NSString *)message; -- (UILabel *)infoLabel; + + +@property (nonatomic, copy) NSString *message; + +@property (nonatomic, readonly, assign) BOOL visible; + +@property (nonatomic, assign) NSTimeInterval hideAnimationDelay; +@property (nonatomic, assign) NSTimeInterval hideAnimationDuration; +@property (nonatomic, assign) NSTimeInterval showAnimationDuration; + +@property (nonatomic, retain) UIColor *textColor; +@property (nonatomic, retain) UIFont *textFont; + +@property (nonatomic, readonly) UILabel *infoLabel; @end diff --git a/Code/Library/JBInfoBar.m b/Code/Library/JBInfoBar.m index 7b113f1..dd629f0 100644 --- a/Code/Library/JBInfoBar.m +++ b/Code/Library/JBInfoBar.m @@ -6,99 +6,109 @@ // Copyright 2011 ThinkDiff.ch. All rights reserved. // -#import "JBInfoBar.h" +#import "JBInfoBar.h" + +#define kDefaultFontName @"MavenPro" +#define kDefaultFontSize 14 + +#define kDefaultBackgroundColor [UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:0.5] +#define kDefaultTextColor [UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1.0] + +#define kDefaultHideAnimationDelay 0.0f +#define kDefaultHideAnimationDuration 1.5f +#define kDefaultShowAnimationDuration 0.5f + + +@interface JBInfoBar () + +- (void) prepareCenterPoints; +- (void) prepareInfoLabel; +- (void) prepareDefaultTimings; + +@end + @implementation JBInfoBar -@synthesize isHidden, hideAnimationDelay, hideAnimationDuration, showAnimationDuration; +@synthesize visible; +@synthesize hideAnimationDelay; +@synthesize hideAnimationDuration; +@synthesize showAnimationDuration; -- (id)initWithFrame:(CGRect)frame - backgroundColor:(UIColor *)bColor - textColor:(UIColor *)tColor - textFont:(UIFont *)tFont -{ - self = [super initWithFrame:frame]; - if (self) { - // Initialization code - isHidden = YES; - hiddenCP = CGPointMake(frame.origin.x + frame.size.width / 2.0, frame.origin.y + frame.size.height / 2.0); - showCP = CGPointMake(frame.origin.x + frame.size.width / 2.0, frame.origin.y - frame.size.height / 2.0); - - if (!bColor) { - [self setBackgroundColor:[UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:0.5]]; - } else { - [self setBackgroundColor:bColor]; - } - - [self setHidden:YES]; - - infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; - [infoLabel setTextAlignment:UITextAlignmentCenter]; - - if (!tFont) { - [infoLabel setFont:[UIFont fontWithName:@"MavenPro" size:14]]; - } else { - [infoLabel setFont:tFont]; - } - - if (!tColor) { - [infoLabel setTextColor:[UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1.0]]; - } else { - [infoLabel setTextColor:tColor]; - } - - [infoLabel setBackgroundColor:[UIColor clearColor]]; - - [self addSubview:infoLabel]; - - self.hideAnimationDelay = 0.0f; - self.hideAnimationDuration = 1.5f; - self.showAnimationDuration = 0.5f; - } - return self; + +#pragma Public Action Methods + +- (void)showBarWithMessage:(NSString *)_message { + self.message = _message; + + if(visible) + return; + + [self setHidden:NO]; + [UIView transitionWithView:self duration:showAnimationDuration + options:UIViewAnimationOptionTransitionNone + animations:^ { + self.center = showCP; + } + completion:nil]; + visible = YES; } -- (void)setMessage:(NSString *)message { - if (message != nil) infoLabel.text = message; +- (void)hideBarWithMessage:(NSString *)_message { + self.message = _message; + + if(!visible) + return; + + [UIView animateWithDuration:hideAnimationDuration + delay:hideAnimationDelay + options:UIViewAnimationOptionTransitionNone + animations:^ { + self.center = hiddenCP; + } + completion:^(BOOL finished) { + [self setHidden:YES]; + }]; + visible = NO; } -- (UILabel *)infoLabel { - return infoLabel; +- (void)hideBarImmediately { + if(!visible) + return; + + self.center = hiddenCP; + [self setHidden:YES]; + visible = NO; } -- (void)showBarWithMessage:(NSString *)message { - [self setMessage:message]; - if (isHidden) { - [self setHidden:NO]; - [UIView transitionWithView:self duration:showAnimationDuration - options:UIViewAnimationOptionTransitionNone - animations:^ { self.center = showCP; } - completion:nil]; - isHidden = NO; - } +#pragma mark Property Accessors + +- (void)setMessage:(NSString *)_message { + infoLabel.text = _message; } -- (void)hideBarWithMessage:(NSString *)message { - if (message) - [self setMessage:message]; - if (!isHidden) { - [UIView animateWithDuration:hideAnimationDuration - delay:hideAnimationDelay - options:UIViewAnimationOptionTransitionNone - animations:^ { self.center = hiddenCP; } - completion:^(BOOL finished) { - [self setHidden:YES]; - }]; - isHidden = YES; - } +- (NSString*)message { + return infoLabel.text; } -- (void)hideBarImmediately { - if (!isHidden) { - self.center = hiddenCP; - [self setHidden:YES]; - isHidden = YES; - } +- (void) setTextColor:(UIColor *)textColor { + infoLabel.textColor = textColor; +} + +- (UIColor*) textColor { + return infoLabel.textColor; +} + +- (void) setTextFont:(UIFont *)textFont { + infoLabel.font = textFont; +} + +- (UIFont*) textFont { + return infoLabel.font; +} + +- (UILabel *)infoLabel { + return infoLabel; } /* @@ -108,11 +118,56 @@ - (void)drawRect:(CGRect)rect { // Drawing code } -*/ + */ -- (void)dealloc -{ +#pragma mark Instance Lifecycle + +- (id)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + visible = NO; + + [self prepareCenterPoints]; + [self prepareInfoLabel]; + + self.backgroundColor = kDefaultBackgroundColor; + self.hidden = YES; + + [self prepareDefaultTimings]; + } + return self; +} + +- (void) prepareCenterPoints { + double centerX = self.frame.origin.x + self.frame.size.width / 2.0; + double hiddenCenterY = self.frame.origin.y + self.frame.size.height / 2.0; + double shownCenterY = self.frame.origin.y - self.frame.size.height / 2.0; + + hiddenCP = CGPointMake(centerX, hiddenCenterY); + showCP = CGPointMake(centerX, shownCenterY); +} + +- (void) prepareInfoLabel { + infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; + + infoLabel.textAlignment = UITextAlignmentCenter; + infoLabel.font = [UIFont fontWithName:kDefaultFontName size:kDefaultFontSize]; + + infoLabel.textColor = kDefaultTextColor; + infoLabel.backgroundColor = [UIColor clearColor]; + + [self addSubview:infoLabel]; +} + +- (void) prepareDefaultTimings { + hideAnimationDelay = kDefaultHideAnimationDelay; + hideAnimationDuration = kDefaultHideAnimationDuration; + showAnimationDuration = kDefaultShowAnimationDuration; +} + +- (void)dealloc { [infoLabel release]; + [super dealloc]; } diff --git a/InfoBar.xcodeproj/project.pbxproj b/InfoBar.xcodeproj/project.pbxproj index 5068398..b0da8c9 100644 --- a/InfoBar.xcodeproj/project.pbxproj +++ b/InfoBar.xcodeproj/project.pbxproj @@ -149,10 +149,10 @@ BF7B4630153C6E1E00616962 /* Library */ = { isa = PBXGroup; children = ( - BF7B4631153C6E1E00616962 /* JBInfoBar.h */, - BF7B4632153C6E1E00616962 /* JBInfoBar.m */, BF7B4633153C6E1E00616962 /* JBInfoBarManager.h */, BF7B4634153C6E1E00616962 /* JBInfoBarManager.m */, + BF7B4631153C6E1E00616962 /* JBInfoBar.h */, + BF7B4632153C6E1E00616962 /* JBInfoBar.m */, BF7B4653153C6F6B00616962 /* Supporting Files */, ); path = Library; From ef95640e6585aa2c7561b6d51aa1df414e3a0346 Mon Sep 17 00:00:00 2001 From: Graham Haworth Date: Mon, 16 Apr 2012 13:20:20 -0500 Subject: [PATCH 4/8] Replaced the JBInfoBarManager with a category for UITabBarControllers that handle creation and delegation of calls to the JBInfoBar without forcing a singleton instance to be used (this can be used with multiple, separate UITabBarControllers) --- Code/Demo/FirstViewController.h | 4 +- Code/Demo/FirstViewController.m | 8 +- Code/Demo/InfoBarAppDelegate.h | 6 +- Code/Demo/InfoBarAppDelegate.m | 20 +--- Code/Demo/SecondViewController.m | 8 +- Code/Library/JBInfoBar.h | 7 +- Code/Library/JBInfoBar.m | 25 ++-- Code/Library/JBInfoBarManager.h | 29 ----- Code/Library/JBInfoBarManager.m | 108 ------------------ .../UITabBarController+JBInfoBar.h | 28 +++++ .../UITabBarController+JBInfoBar.m | 93 +++++++++++++++ InfoBar.xcodeproj/project.pbxproj | 48 +++++--- 12 files changed, 189 insertions(+), 195 deletions(-) delete mode 100644 Code/Library/JBInfoBarManager.h delete mode 100644 Code/Library/JBInfoBarManager.m create mode 100644 Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h create mode 100644 Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m diff --git a/Code/Demo/FirstViewController.h b/Code/Demo/FirstViewController.h index 59cdeeb..efbe90a 100644 --- a/Code/Demo/FirstViewController.h +++ b/Code/Demo/FirstViewController.h @@ -9,9 +9,7 @@ #import -@interface FirstViewController : UIViewController { - -} +@interface FirstViewController : UIViewController - (IBAction)runAction; diff --git a/Code/Demo/FirstViewController.m b/Code/Demo/FirstViewController.m index 915fd94..150ce60 100644 --- a/Code/Demo/FirstViewController.m +++ b/Code/Demo/FirstViewController.m @@ -7,7 +7,8 @@ // #import "FirstViewController.h" -#import "JBInfoBarManager.h" +#import "InfoBarAppDelegate.h" +#import "UITabBarController+JBInfoBar.h" @implementation FirstViewController @@ -20,8 +21,9 @@ - (void)viewDidLoad */ - (IBAction)runAction { - [[JBInfoBarManager sharedManager] showInfoBarWithMessage:@"Action from View 1"]; - [NSTimer scheduledTimerWithTimeInterval:5.0 target:[JBInfoBarManager sharedManager] selector:@selector(hideInfoBar) userInfo:nil repeats:NO]; + InfoBarAppDelegate *appDelegate = (InfoBarAppDelegate*) [[UIApplication sharedApplication] delegate]; + [appDelegate.tabBarController showInfoBarWithMessage:@"Action from View 1"]; + [NSTimer scheduledTimerWithTimeInterval:5.0 target:appDelegate.tabBarController selector:@selector(hideInfoBar) userInfo:nil repeats:NO]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation diff --git a/Code/Demo/InfoBarAppDelegate.h b/Code/Demo/InfoBarAppDelegate.h index a92c17d..9a893ba 100644 --- a/Code/Demo/InfoBarAppDelegate.h +++ b/Code/Demo/InfoBarAppDelegate.h @@ -7,13 +7,13 @@ // #import + #import "JBInfoBar.h" -@interface InfoBarAppDelegate : NSObject { -} -@property (nonatomic, retain) IBOutlet UIWindow *window; +@interface InfoBarAppDelegate : NSObject +@property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UITabBarController *tabBarController; @end diff --git a/Code/Demo/InfoBarAppDelegate.m b/Code/Demo/InfoBarAppDelegate.m index a3f2b71..f154f54 100644 --- a/Code/Demo/InfoBarAppDelegate.m +++ b/Code/Demo/InfoBarAppDelegate.m @@ -7,7 +7,8 @@ // #import "InfoBarAppDelegate.h" -#import "JBInfoBarManager.h" +#import "UITabBarController+JBInfoBar.h" + @implementation InfoBarAppDelegate @@ -16,29 +17,20 @@ @implementation InfoBarAppDelegate @synthesize tabBarController=_tabBarController; -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. // Add the tab bar controller's current view as a subview of the window self.window.rootViewController = self.tabBarController; [self.window makeKeyAndVisible]; // Add the infoBar - [[JBInfoBarManager sharedManager] initInfoBarWithFrame:CGRectMake(0, self.tabBarController.tabBar.frame.origin.y, - self.tabBarController.tabBar.frame.size.width, 30) - backgroundColor:[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.6f] - textColor:[UIColor whiteColor] - textFont:[UIFont systemFontOfSize:17.0f]]; - - [self.tabBarController.view insertSubview:[[JBInfoBarManager sharedManager] infoBar] belowSubview:self.tabBarController.tabBar]; - [[JBInfoBarManager sharedManager] showInfoBarWithMessage:@"Test Up!"]; + [self.tabBarController showInfoBarWithMessage:@"Test Up!"]; return YES; } -- (void)hideInfoBar -{ - [[JBInfoBarManager sharedManager] hideInfoBarWithMessage:@"Finished!"]; +- (void)hideInfoBar { + [self.tabBarController hideInfoBarWithMessage:@"Finished!"]; } - (void)applicationWillResignActive:(UIApplication *)application diff --git a/Code/Demo/SecondViewController.m b/Code/Demo/SecondViewController.m index d28e69d..536605b 100644 --- a/Code/Demo/SecondViewController.m +++ b/Code/Demo/SecondViewController.m @@ -7,7 +7,8 @@ // #import "SecondViewController.h" -#import "JBInfoBarManager.h" +#import "InfoBarAppDelegate.h" +#import "UITabBarController+JBInfoBar.h" @implementation SecondViewController @@ -20,8 +21,9 @@ - (void)viewDidLoad */ - (IBAction)runAction { - [[JBInfoBarManager sharedManager] showInfoBarWithMessage:@"Action from View 2"]; - [NSTimer scheduledTimerWithTimeInterval:5.0 target:[JBInfoBarManager sharedManager] selector:@selector(hideInfoBar) userInfo:nil repeats:NO]; + InfoBarAppDelegate *appDelegate = (InfoBarAppDelegate*) [[UIApplication sharedApplication] delegate]; + [appDelegate.tabBarController showInfoBarWithMessage:@"Action from View 2"]; + [NSTimer scheduledTimerWithTimeInterval:5.0 target:appDelegate.tabBarController selector:@selector(hideInfoBar) userInfo:nil repeats:NO]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation diff --git a/Code/Library/JBInfoBar.h b/Code/Library/JBInfoBar.h index b6ae475..8d2fc68 100644 --- a/Code/Library/JBInfoBar.h +++ b/Code/Library/JBInfoBar.h @@ -20,9 +20,10 @@ - (id)initWithFrame:(CGRect)frame; -- (void)showBarWithMessage:(NSString *)message; -- (void)hideBarWithMessage:(NSString *)message; -- (void)hideBarImmediately; +- (void)showWithMessage:(NSString *)message; +- (void)hide; +- (void)hideWithMessage:(NSString *)message; +- (void)hideImmediately; @property (nonatomic, copy) NSString *message; diff --git a/Code/Library/JBInfoBar.m b/Code/Library/JBInfoBar.m index dd629f0..b7874d3 100644 --- a/Code/Library/JBInfoBar.m +++ b/Code/Library/JBInfoBar.m @@ -8,11 +8,10 @@ #import "JBInfoBar.h" -#define kDefaultFontName @"MavenPro" -#define kDefaultFontSize 14 +#define kDefaultFont [UIFont systemFontOfSize:17.0f] -#define kDefaultBackgroundColor [UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:0.5] -#define kDefaultTextColor [UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1.0] +#define kDefaultBackgroundColor [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.6f] +#define kDefaultTextColor [UIColor whiteColor] #define kDefaultHideAnimationDelay 0.0f #define kDefaultHideAnimationDuration 1.5f @@ -38,7 +37,7 @@ @implementation JBInfoBar #pragma Public Action Methods -- (void)showBarWithMessage:(NSString *)_message { +- (void)showWithMessage:(NSString *)_message { self.message = _message; if(visible) @@ -54,9 +53,7 @@ - (void)showBarWithMessage:(NSString *)_message { visible = YES; } -- (void)hideBarWithMessage:(NSString *)_message { - self.message = _message; - +- (void)hide { if(!visible) return; @@ -72,7 +69,13 @@ - (void)hideBarWithMessage:(NSString *)_message { visible = NO; } -- (void)hideBarImmediately { +- (void)hideWithMessage:(NSString *)_message { + self.message = _message; + + [self hide]; +} + +- (void)hideImmediately { if(!visible) return; @@ -151,10 +154,10 @@ - (void) prepareInfoLabel { infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; infoLabel.textAlignment = UITextAlignmentCenter; - infoLabel.font = [UIFont fontWithName:kDefaultFontName size:kDefaultFontSize]; + infoLabel.backgroundColor = [UIColor clearColor]; + infoLabel.font = kDefaultFont; infoLabel.textColor = kDefaultTextColor; - infoLabel.backgroundColor = [UIColor clearColor]; [self addSubview:infoLabel]; } diff --git a/Code/Library/JBInfoBarManager.h b/Code/Library/JBInfoBarManager.h deleted file mode 100644 index 98090d4..0000000 --- a/Code/Library/JBInfoBarManager.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// JBInfoBarManager.h -// InfoBar -// -// Created by Junior on 02/03/2011. -// Copyright 2011 __MyCompanyName__. All rights reserved. -// - -#import -#import "JBInfoBar.h" - -@interface JBInfoBarManager : NSObject { - JBInfoBar *infoBar; -} - -@property (nonatomic, assign) JBInfoBar *infoBar; - -+ (JBInfoBarManager *)sharedManager; - -- (void)initInfoBarWithFrame:(CGRect)frame - backgroundColor:(UIColor *)bColor - textColor:(UIColor *)tColor - textFont:(UIFont *)tFont; - -- (void)showInfoBarWithMessage:(NSString *)message; -- (void)hideInfoBarWithMessage:(NSString *)message; -- (void)hideInfoBarImmediately; - -@end diff --git a/Code/Library/JBInfoBarManager.m b/Code/Library/JBInfoBarManager.m deleted file mode 100644 index addb6a7..0000000 --- a/Code/Library/JBInfoBarManager.m +++ /dev/null @@ -1,108 +0,0 @@ -// -// JBInfoBarManager.m -// InfoBar -// -// Created by Junior on 02/03/2011. -// Copyright 2011 __MyCompanyName__. All rights reserved. -// - -#import "JBInfoBarManager.h" - -static JBInfoBarManager *sharedJBInfoBarManager = nil; - -@implementation JBInfoBarManager - -@synthesize infoBar; - -#pragma mark Init - -- (id)init { - self = [super init]; - if (self) { - infoBar = nil; - } - return self; -} - -#pragma mark - -#pragma mark Manager - -- (void)initInfoBarWithFrame:(CGRect)frame - backgroundColor:(UIColor *)bColor - textColor:(UIColor *)tColor - textFont:(UIFont *)tFont { - if (infoBar) { - [infoBar removeFromSuperview]; - [infoBar release], infoBar = nil; - } - infoBar = [[JBInfoBar alloc] initWithFrame:frame - backgroundColor:bColor - textColor:tColor - textFont:tFont]; -} - -- (void)showInfoBarWithMessage:(NSString *)message { - [infoBar showBarWithMessage:message]; -} - -- (void)hideInfoBarWithMessage:(NSString *)message { - [infoBar hideBarWithMessage:message]; -} - -- (void)hideInfoBar { - [infoBar hideBarWithMessage:nil]; -} - -- (void)hideInfoBarImmediately { - [infoBar hideBarImmediately]; -} - -#pragma mark - -#pragma mark Singleton - -+ (JBInfoBarManager *)sharedManager -{ - @synchronized(self) { - if (sharedJBInfoBarManager == nil) { - sharedJBInfoBarManager = [[super alloc] init]; - } - } - return sharedJBInfoBarManager; -} - -+ (id)allocWithZone:(NSZone *)zone -{ - @synchronized(self) { - if (sharedJBInfoBarManager == nil) { - sharedJBInfoBarManager = [super allocWithZone:zone]; - return sharedJBInfoBarManager; - } - } - return nil; -} - -- (id)copyWithZone:(NSZone *)zone -{ - return self; -} - -- (id)retain -{ - return self; -} - -- (NSUInteger)retainCount -{ - return NSUIntegerMax; //denotes an object that cannot be released -} - -- (oneway void)release -{ - //do nothing -} - -- (id)autorelease -{ - return self; -} -@end diff --git a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h new file mode 100644 index 0000000..95d4767 --- /dev/null +++ b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h @@ -0,0 +1,28 @@ +// +// UITabBarController+JBInfoBar.h +// InfoBar +// +// Created by Graham Haworth on 4/16/12. +// + +#import + +#import "JBInfoBar.h" + + +@interface UITabBarController (JBInfoBar) + ++ (void) setDefaultInfoBarTag:(NSInteger)tag; ++ (NSInteger) defaultInfoBarTag; + +- (JBInfoBar*) createDefaultInfoBar; +- (JBInfoBar*) createDefaultInfoBarWithHeight:(NSInteger)height; + +- (void) showInfoBarWithMessage:(NSString *)message; +- (void) hideInfoBar; +- (void) hideInfoBarWithMessage:(NSString *)message; +- (void) hideInfoBarImmediately; + +@property (nonatomic, retain) JBInfoBar *infoBar; + +@end diff --git a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m new file mode 100644 index 0000000..c55b1e2 --- /dev/null +++ b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m @@ -0,0 +1,93 @@ +// +// UITabBarController+JBInfoBar.m +// InfoBar +// +// Created by Graham Haworth on 4/16/12. +// + +#import "UITabBarController+JBInfoBar.h" + + +#define kDefaultUndefinedInfoBarTag 2048 + +#define kDefaultInfoBarHeight 30 + + +@implementation UITabBarController (JBInfoBar) + + +static NSInteger defaultInfoBarTag = kDefaultUndefinedInfoBarTag; + ++ (void) setDefaultInfoBarTag:(NSInteger)tag { + defaultInfoBarTag = tag; +} + ++ (NSInteger) defaultInfoBarTag { + return defaultInfoBarTag; +} + +- (JBInfoBar*) infoBar { + return (JBInfoBar*) [self.view viewWithTag:defaultInfoBarTag]; +} + +- (void) setInfoBar:(JBInfoBar *)infoBar { + JBInfoBar *oldInfoBar = [self infoBar]; + if(oldInfoBar) + [oldInfoBar removeFromSuperview]; + + [self insertInfoBar:infoBar]; +} + +- (void) showInfoBarWithMessage:(NSString *)message { + JBInfoBar *infoBar = self.infoBar; + if(!infoBar) { + infoBar = [self createDefaultInfoBar]; + [self insertInfoBar:infoBar]; + } + + [infoBar showWithMessage:message]; +} + +- (void) hideInfoBar { + [self.infoBar hide]; +} + +- (void) hideInfoBarWithMessage:(NSString *)message { + [self.infoBar hideWithMessage:message]; +} + +- (void) hideInfoBarImmediately { + [self.infoBar hideImmediately]; +} + +- (void) insertInfoBar:(JBInfoBar *)infoBar { + [self.view insertSubview:infoBar belowSubview:self.tabBar]; +} + +- (JBInfoBar*) createDefaultInfoBar { + return [self createDefaultInfoBarWithHeight:kDefaultInfoBarHeight]; +} + +- (JBInfoBar*) createDefaultInfoBarWithHeight:(NSInteger)height { + CGRect frame = CGRectMake(0, self.tabBar.frame.origin.y, self.tabBar.frame.size.width, height); + JBInfoBar *infoBar = [[[JBInfoBar alloc] initWithFrame:frame] autorelease]; + infoBar.tag = [[self class] defaultInfoBarTag]; + return infoBar; +} + +@end + + + + + + + + + + + + + + + diff --git a/InfoBar.xcodeproj/project.pbxproj b/InfoBar.xcodeproj/project.pbxproj index b0da8c9..b5e18ca 100644 --- a/InfoBar.xcodeproj/project.pbxproj +++ b/InfoBar.xcodeproj/project.pbxproj @@ -18,16 +18,13 @@ BF7B463B153C6E1E00616962 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = BF7B462A153C6E1E00616962 /* InfoPlist.strings */; }; BF7B463C153C6E1E00616962 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF7B462C153C6E1E00616962 /* MainWindow.xib */; }; BF7B463D153C6E1E00616962 /* SecondView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF7B462E153C6E1E00616962 /* SecondView.xib */; }; - BF7B463E153C6E1E00616962 /* JBInfoBar.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4632153C6E1E00616962 /* JBInfoBar.m */; }; - BF7B463F153C6E1E00616962 /* JBInfoBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4634153C6E1E00616962 /* JBInfoBarManager.m */; }; BF7B4647153C6EF300616962 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B5FB2821311514600719F62 /* Foundation.framework */; }; BF7B4657153C6FC600616962 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = BF7B4655153C6FC600616962 /* Icon.png */; }; BF7B4658153C6FC600616962 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = BF7B4656153C6FC600616962 /* Icon@2x.png */; }; BF7B465E153C702900616962 /* libInfoBarStaticLibrary.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BF7B4646153C6EF300616962 /* libInfoBarStaticLibrary.a */; }; - BF7B4661153C734700616962 /* JBInfoBar.h in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4631153C6E1E00616962 /* JBInfoBar.h */; }; BF7B4662153C734700616962 /* JBInfoBar.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4632153C6E1E00616962 /* JBInfoBar.m */; }; - BF7B4663153C734700616962 /* JBInfoBarManager.h in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4633153C6E1E00616962 /* JBInfoBarManager.h */; }; - BF7B4664153C734700616962 /* JBInfoBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4634153C6E1E00616962 /* JBInfoBarManager.m */; }; + BF7B466D153C860500616962 /* UITabBarController+JBInfoBar.h in Headers */ = {isa = PBXBuildFile; fileRef = BF7B466B153C860500616962 /* UITabBarController+JBInfoBar.h */; }; + BF7B466E153C860500616962 /* UITabBarController+JBInfoBar.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B466C153C860500616962 /* UITabBarController+JBInfoBar.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -60,12 +57,12 @@ BF7B462F153C6E1E00616962 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/SecondView.xib; sourceTree = ""; }; BF7B4631153C6E1E00616962 /* JBInfoBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JBInfoBar.h; sourceTree = ""; }; BF7B4632153C6E1E00616962 /* JBInfoBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JBInfoBar.m; sourceTree = ""; }; - BF7B4633153C6E1E00616962 /* JBInfoBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JBInfoBarManager.h; sourceTree = ""; }; - BF7B4634153C6E1E00616962 /* JBInfoBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JBInfoBarManager.m; sourceTree = ""; }; BF7B4646153C6EF300616962 /* libInfoBarStaticLibrary.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libInfoBarStaticLibrary.a; sourceTree = BUILT_PRODUCTS_DIR; }; BF7B4652153C6F6600616962 /* InfoBarStaticLibrary-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "InfoBarStaticLibrary-Prefix.pch"; sourceTree = ""; }; BF7B4655153C6FC600616962 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; BF7B4656153C6FC600616962 /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = ""; }; + BF7B466B153C860500616962 /* UITabBarController+JBInfoBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITabBarController+JBInfoBar.h"; sourceTree = ""; }; + BF7B466C153C860500616962 /* UITabBarController+JBInfoBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITabBarController+JBInfoBar.m"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -149,10 +146,9 @@ BF7B4630153C6E1E00616962 /* Library */ = { isa = PBXGroup; children = ( - BF7B4633153C6E1E00616962 /* JBInfoBarManager.h */, - BF7B4634153C6E1E00616962 /* JBInfoBarManager.m */, BF7B4631153C6E1E00616962 /* JBInfoBar.h */, BF7B4632153C6E1E00616962 /* JBInfoBar.m */, + BF7B466A153C860500616962 /* UIKit Additions */, BF7B4653153C6F6B00616962 /* Supporting Files */, ); path = Library; @@ -186,6 +182,15 @@ path = Resources; sourceTree = ""; }; + BF7B466A153C860500616962 /* UIKit Additions */ = { + isa = PBXGroup; + children = ( + BF7B466B153C860500616962 /* UITabBarController+JBInfoBar.h */, + BF7B466C153C860500616962 /* UITabBarController+JBInfoBar.m */, + ); + path = "UIKit Additions"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -193,6 +198,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + BF7B466D153C860500616962 /* UITabBarController+JBInfoBar.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -282,8 +288,6 @@ BF7B4637153C6E1E00616962 /* InfoBarAppDelegate.m in Sources */, BF7B4638153C6E1E00616962 /* main.m in Sources */, BF7B4639153C6E1E00616962 /* SecondViewController.m in Sources */, - BF7B463E153C6E1E00616962 /* JBInfoBar.m in Sources */, - BF7B463F153C6E1E00616962 /* JBInfoBarManager.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -291,10 +295,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - BF7B4661153C734700616962 /* JBInfoBar.h in Sources */, BF7B4662153C734700616962 /* JBInfoBar.m in Sources */, - BF7B4663153C734700616962 /* JBInfoBarManager.h in Sources */, - BF7B4664153C734700616962 /* JBInfoBarManager.m in Sources */, + BF7B466E153C860500616962 /* UITabBarController+JBInfoBar.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -352,8 +354,9 @@ GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.0; SDKROOT = iphoneos; @@ -366,8 +369,9 @@ ARCHS = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; @@ -384,6 +388,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Code/Demo/InfoBarDemo-Prefix.pch"; INFOPLIST_FILE = "Code/Demo/InfoBarDemo-Info.plist"; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -397,6 +402,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Code/Demo/InfoBarDemo-Prefix.pch"; INFOPLIST_FILE = "Code/Demo/InfoBarDemo-Info.plist"; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; @@ -407,11 +413,14 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + "ARCHS[sdk=iphoneos*]" = ( + armv6, + armv7, + ); COPY_PHASE_STRIP = NO; DSTROOT = /tmp/InfoBarStaticLibrary.dst; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Code/Library/InfoBarStaticLibrary-Prefix.pch"; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_UNINITIALIZED_AUTOS = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -423,11 +432,14 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + "ARCHS[sdk=iphoneos*]" = ( + armv6, + armv7, + ); COPY_PHASE_STRIP = YES; DSTROOT = /tmp/InfoBarStaticLibrary.dst; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Code/Library/InfoBarStaticLibrary-Prefix.pch"; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_UNINITIALIZED_AUTOS = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; From f8423d8bb12fd8d448070e0ead803caf14cc9041 Mon Sep 17 00:00:00 2001 From: Graham Haworth Date: Mon, 16 Apr 2012 13:29:15 -0500 Subject: [PATCH 5/8] Cleaned up the category files a little. --- .../UITabBarController+JBInfoBar.h | 7 +++-- .../UITabBarController+JBInfoBar.m | 30 ++++++++++++------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h index 95d4767..4faa37e 100644 --- a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h +++ b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h @@ -15,14 +15,15 @@ + (void) setDefaultInfoBarTag:(NSInteger)tag; + (NSInteger) defaultInfoBarTag; -- (JBInfoBar*) createDefaultInfoBar; -- (JBInfoBar*) createDefaultInfoBarWithHeight:(NSInteger)height; - - (void) showInfoBarWithMessage:(NSString *)message; - (void) hideInfoBar; - (void) hideInfoBarWithMessage:(NSString *)message; - (void) hideInfoBarImmediately; +// These probably should not be used unless special configuration is needed +- (JBInfoBar*) createDefaultInfoBar; +- (JBInfoBar*) createDefaultInfoBarWithHeight:(NSInteger)height; + @property (nonatomic, retain) JBInfoBar *infoBar; @end diff --git a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m index c55b1e2..92b6d52 100644 --- a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m +++ b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m @@ -9,22 +9,13 @@ #define kDefaultUndefinedInfoBarTag 2048 - #define kDefaultInfoBarHeight 30 @implementation UITabBarController (JBInfoBar) -static NSInteger defaultInfoBarTag = kDefaultUndefinedInfoBarTag; - -+ (void) setDefaultInfoBarTag:(NSInteger)tag { - defaultInfoBarTag = tag; -} - -+ (NSInteger) defaultInfoBarTag { - return defaultInfoBarTag; -} +#pragma mark Public Accessors - (JBInfoBar*) infoBar { return (JBInfoBar*) [self.view viewWithTag:defaultInfoBarTag]; @@ -38,6 +29,9 @@ - (void) setInfoBar:(JBInfoBar *)infoBar { [self insertInfoBar:infoBar]; } + +#pragma mark Action Methods + - (void) showInfoBarWithMessage:(NSString *)message { JBInfoBar *infoBar = self.infoBar; if(!infoBar) { @@ -60,6 +54,9 @@ - (void) hideInfoBarImmediately { [self.infoBar hideImmediately]; } + +#pragma mark Utility Methods + - (void) insertInfoBar:(JBInfoBar *)infoBar { [self.view insertSubview:infoBar belowSubview:self.tabBar]; } @@ -75,6 +72,19 @@ - (JBInfoBar*) createDefaultInfoBarWithHeight:(NSInteger)height { return infoBar; } + +#pragma mark Global Configuration + +static NSInteger defaultInfoBarTag = kDefaultUndefinedInfoBarTag; + ++ (void) setDefaultInfoBarTag:(NSInteger)tag { + defaultInfoBarTag = tag; +} + ++ (NSInteger) defaultInfoBarTag { + return defaultInfoBarTag; +} + @end From 7e257e268f5190599af8747423a2553ec425c6a7 Mon Sep 17 00:00:00 2001 From: Graham Haworth Date: Mon, 16 Apr 2012 15:38:17 -0500 Subject: [PATCH 6/8] Added a method to show a message and have it automatically hide after a delay. --- Code/Library/JBInfoBar.h | 3 +++ Code/Library/JBInfoBar.m | 24 +++++++++++++++++++ .../UITabBarController+JBInfoBar.h | 2 ++ .../UITabBarController+JBInfoBar.m | 21 +++++++++++----- 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/Code/Library/JBInfoBar.h b/Code/Library/JBInfoBar.h index 8d2fc68..54fc73e 100644 --- a/Code/Library/JBInfoBar.h +++ b/Code/Library/JBInfoBar.h @@ -15,12 +15,15 @@ @private UILabel *infoLabel; + NSTimer *hideTimer; } - (id)initWithFrame:(CGRect)frame; - (void)showWithMessage:(NSString *)message; +- (void)showWithMessage:(NSString *)message hideAfterDelay:(NSTimeInterval)delay; + - (void)hide; - (void)hideWithMessage:(NSString *)message; - (void)hideImmediately; diff --git a/Code/Library/JBInfoBar.m b/Code/Library/JBInfoBar.m index b7874d3..02865a7 100644 --- a/Code/Library/JBInfoBar.m +++ b/Code/Library/JBInfoBar.m @@ -24,6 +24,8 @@ - (void) prepareCenterPoints; - (void) prepareInfoLabel; - (void) prepareDefaultTimings; +- (void) cancelAndClearHideTimer; + @end @@ -38,6 +40,8 @@ @implementation JBInfoBar #pragma Public Action Methods - (void)showWithMessage:(NSString *)_message { + [self cancelAndClearHideTimer]; + self.message = _message; if(visible) @@ -53,7 +57,15 @@ - (void)showWithMessage:(NSString *)_message { visible = YES; } +- (void)showWithMessage:(NSString *)message hideAfterDelay:(NSTimeInterval)delay { + [self showWithMessage:message]; + + hideTimer = [[NSTimer scheduledTimerWithTimeInterval:delay target:self selector:@selector(hide) userInfo:nil repeats:NO] retain]; +} + - (void)hide { + [self cancelAndClearHideTimer]; + if(!visible) return; @@ -70,12 +82,16 @@ - (void)hide { } - (void)hideWithMessage:(NSString *)_message { + [self cancelAndClearHideTimer]; + self.message = _message; [self hide]; } - (void)hideImmediately { + [self cancelAndClearHideTimer]; + if(!visible) return; @@ -84,6 +100,14 @@ - (void)hideImmediately { visible = NO; } +#pragma mark Utility Methods + +- (void) cancelAndClearHideTimer { + [hideTimer invalidate]; + [hideTimer release]; + hideTimer = nil; +} + #pragma mark Property Accessors - (void)setMessage:(NSString *)_message { diff --git a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h index 4faa37e..c36c60d 100644 --- a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h +++ b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h @@ -16,6 +16,8 @@ + (NSInteger) defaultInfoBarTag; - (void) showInfoBarWithMessage:(NSString *)message; +- (void) showInfoBarWithMessage:(NSString *)message hideAfterDelay:(NSTimeInterval)delay; + - (void) hideInfoBar; - (void) hideInfoBarWithMessage:(NSString *)message; - (void) hideInfoBarImmediately; diff --git a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m index 92b6d52..65ece7f 100644 --- a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m +++ b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m @@ -33,15 +33,15 @@ - (void) setInfoBar:(JBInfoBar *)infoBar { #pragma mark Action Methods - (void) showInfoBarWithMessage:(NSString *)message { - JBInfoBar *infoBar = self.infoBar; - if(!infoBar) { - infoBar = [self createDefaultInfoBar]; - [self insertInfoBar:infoBar]; - } - + JBInfoBar *infoBar = [self getOrCreateInfoBar]; [infoBar showWithMessage:message]; } +- (void) showInfoBarWithMessage:(NSString *)message hideAfterDelay:(NSTimeInterval)delay { + JBInfoBar *infoBar = [self getOrCreateInfoBar]; + [infoBar showWithMessage:message hideAfterDelay:delay]; +} + - (void) hideInfoBar { [self.infoBar hide]; } @@ -72,6 +72,15 @@ - (JBInfoBar*) createDefaultInfoBarWithHeight:(NSInteger)height { return infoBar; } +- (JBInfoBar*) getOrCreateInfoBar { + JBInfoBar *infoBar = self.infoBar; + if(!infoBar) { + infoBar = [self createDefaultInfoBar]; + [self insertInfoBar:infoBar]; + } + return infoBar; +} + #pragma mark Global Configuration From c0605109945fde5b686cf2778658c47aaf849f3e Mon Sep 17 00:00:00 2001 From: Graham Haworth Date: Sat, 6 Oct 2012 18:30:32 -0500 Subject: [PATCH 7/8] Updated some of the project flags to increase compatibility. --- InfoBar.xcodeproj/project.pbxproj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/InfoBar.xcodeproj/project.pbxproj b/InfoBar.xcodeproj/project.pbxproj index b5e18ca..d0ba3eb 100644 --- a/InfoBar.xcodeproj/project.pbxproj +++ b/InfoBar.xcodeproj/project.pbxproj @@ -358,8 +358,9 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; SDKROOT = iphoneos; + VALID_ARCHS = "armv7 armv7s i386"; }; name = Debug; }; @@ -373,9 +374,10 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; + VALID_ARCHS = "armv7 armv7s i386"; }; name = Release; }; From 988d1e6135423a55b45f77bc15c4d131c8b2e175 Mon Sep 17 00:00:00 2001 From: Graham Haworth Date: Sat, 6 Oct 2012 20:27:01 -0500 Subject: [PATCH 8/8] Added compatibility for UIViewControllers to the UIKit Additions. --- .../UITabBarController+JBInfoBar.h | 19 +-- .../UITabBarController+JBInfoBar.m | 75 +----------- .../UIViewController+JBInfoBar.h | 31 +++++ .../UIViewController+JBInfoBar.m | 112 ++++++++++++++++++ InfoBar.xcodeproj/project.pbxproj | 24 ++-- 5 files changed, 163 insertions(+), 98 deletions(-) create mode 100644 Code/Library/UIKit Additions/UIViewController+JBInfoBar.h create mode 100644 Code/Library/UIKit Additions/UIViewController+JBInfoBar.m diff --git a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h index c36c60d..05362c5 100644 --- a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h +++ b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.h @@ -5,27 +5,14 @@ // Created by Graham Haworth on 4/16/12. // -#import - #import "JBInfoBar.h" +#import "UIViewController+JBInfoBar.h" +#import -@interface UITabBarController (JBInfoBar) - -+ (void) setDefaultInfoBarTag:(NSInteger)tag; -+ (NSInteger) defaultInfoBarTag; - -- (void) showInfoBarWithMessage:(NSString *)message; -- (void) showInfoBarWithMessage:(NSString *)message hideAfterDelay:(NSTimeInterval)delay; -- (void) hideInfoBar; -- (void) hideInfoBarWithMessage:(NSString *)message; -- (void) hideInfoBarImmediately; +@interface UITabBarController (JBInfoBar) -// These probably should not be used unless special configuration is needed -- (JBInfoBar*) createDefaultInfoBar; - (JBInfoBar*) createDefaultInfoBarWithHeight:(NSInteger)height; -@property (nonatomic, retain) JBInfoBar *infoBar; - @end diff --git a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m index 65ece7f..cbc0ce3 100644 --- a/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m +++ b/Code/Library/UIKit Additions/UITabBarController+JBInfoBar.m @@ -5,66 +5,15 @@ // Created by Graham Haworth on 4/16/12. // -#import "UITabBarController+JBInfoBar.h" - - -#define kDefaultUndefinedInfoBarTag 2048 -#define kDefaultInfoBarHeight 30 +#import "UIViewController+JBInfoBar.h" @implementation UITabBarController (JBInfoBar) - -#pragma mark Public Accessors - -- (JBInfoBar*) infoBar { - return (JBInfoBar*) [self.view viewWithTag:defaultInfoBarTag]; -} - -- (void) setInfoBar:(JBInfoBar *)infoBar { - JBInfoBar *oldInfoBar = [self infoBar]; - if(oldInfoBar) - [oldInfoBar removeFromSuperview]; - - [self insertInfoBar:infoBar]; -} - - -#pragma mark Action Methods - -- (void) showInfoBarWithMessage:(NSString *)message { - JBInfoBar *infoBar = [self getOrCreateInfoBar]; - [infoBar showWithMessage:message]; -} - -- (void) showInfoBarWithMessage:(NSString *)message hideAfterDelay:(NSTimeInterval)delay { - JBInfoBar *infoBar = [self getOrCreateInfoBar]; - [infoBar showWithMessage:message hideAfterDelay:delay]; -} - -- (void) hideInfoBar { - [self.infoBar hide]; -} - -- (void) hideInfoBarWithMessage:(NSString *)message { - [self.infoBar hideWithMessage:message]; -} - -- (void) hideInfoBarImmediately { - [self.infoBar hideImmediately]; -} - - -#pragma mark Utility Methods - - (void) insertInfoBar:(JBInfoBar *)infoBar { [self.view insertSubview:infoBar belowSubview:self.tabBar]; } -- (JBInfoBar*) createDefaultInfoBar { - return [self createDefaultInfoBarWithHeight:kDefaultInfoBarHeight]; -} - - (JBInfoBar*) createDefaultInfoBarWithHeight:(NSInteger)height { CGRect frame = CGRectMake(0, self.tabBar.frame.origin.y, self.tabBar.frame.size.width, height); JBInfoBar *infoBar = [[[JBInfoBar alloc] initWithFrame:frame] autorelease]; @@ -72,28 +21,6 @@ - (JBInfoBar*) createDefaultInfoBarWithHeight:(NSInteger)height { return infoBar; } -- (JBInfoBar*) getOrCreateInfoBar { - JBInfoBar *infoBar = self.infoBar; - if(!infoBar) { - infoBar = [self createDefaultInfoBar]; - [self insertInfoBar:infoBar]; - } - return infoBar; -} - - -#pragma mark Global Configuration - -static NSInteger defaultInfoBarTag = kDefaultUndefinedInfoBarTag; - -+ (void) setDefaultInfoBarTag:(NSInteger)tag { - defaultInfoBarTag = tag; -} - -+ (NSInteger) defaultInfoBarTag { - return defaultInfoBarTag; -} - @end diff --git a/Code/Library/UIKit Additions/UIViewController+JBInfoBar.h b/Code/Library/UIKit Additions/UIViewController+JBInfoBar.h new file mode 100644 index 0000000..7a98d27 --- /dev/null +++ b/Code/Library/UIKit Additions/UIViewController+JBInfoBar.h @@ -0,0 +1,31 @@ +// +// UIViewController+JBInfoBar.h +// InfoBar +// +// Created by Graham Haworth on 4/16/12. +// + +#import + +#import "JBInfoBar.h" + + +@interface UIViewController (JBInfoBar) + ++ (void) setDefaultInfoBarTag:(NSInteger)tag; ++ (NSInteger) defaultInfoBarTag; + +- (void) showInfoBarWithMessage:(NSString *)message; +- (void) showInfoBarWithMessage:(NSString *)message hideAfterDelay:(NSTimeInterval)delay; + +- (void) hideInfoBar; +- (void) hideInfoBarWithMessage:(NSString *)message; +- (void) hideInfoBarImmediately; + +// These probably should not be used unless special configuration is needed +- (JBInfoBar*) createDefaultInfoBar; +- (JBInfoBar*) createDefaultInfoBarWithHeight:(NSInteger)height; + +@property (nonatomic, retain) JBInfoBar *infoBar; + +@end diff --git a/Code/Library/UIKit Additions/UIViewController+JBInfoBar.m b/Code/Library/UIKit Additions/UIViewController+JBInfoBar.m new file mode 100644 index 0000000..7c80242 --- /dev/null +++ b/Code/Library/UIKit Additions/UIViewController+JBInfoBar.m @@ -0,0 +1,112 @@ +// +// UIViewController+JBInfoBar.m +// InfoBar +// +// Created by Graham Haworth on 4/16/12. +// + +#import "UIViewController+JBInfoBar.h" + + +#define kDefaultUndefinedInfoBarTag 2048 +#define kDefaultInfoBarHeight 30 + + +@implementation UIViewController (JBInfoBar) + + +#pragma mark Public Accessors + +- (JBInfoBar*) infoBar { + return (JBInfoBar*) [self.view viewWithTag:defaultInfoBarTag]; +} + +- (void) setInfoBar:(JBInfoBar *)infoBar { + JBInfoBar *oldInfoBar = [self infoBar]; + if(oldInfoBar) + [oldInfoBar removeFromSuperview]; + + [self insertInfoBar:infoBar]; +} + + +#pragma mark Action Methods + +- (void) showInfoBarWithMessage:(NSString *)message { + JBInfoBar *infoBar = [self getOrCreateInfoBar]; + [infoBar showWithMessage:message]; +} + +- (void) showInfoBarWithMessage:(NSString *)message hideAfterDelay:(NSTimeInterval)delay { + JBInfoBar *infoBar = [self getOrCreateInfoBar]; + [infoBar showWithMessage:message hideAfterDelay:delay]; +} + +- (void) hideInfoBar { + [self.infoBar hide]; +} + +- (void) hideInfoBarWithMessage:(NSString *)message { + [self.infoBar hideWithMessage:message]; +} + +- (void) hideInfoBarImmediately { + [self.infoBar hideImmediately]; +} + + +#pragma mark Utility Methods + +- (void) insertInfoBar:(JBInfoBar *)infoBar { + [self.view insertSubview:infoBar belowSubview:self.view]; +} + +- (JBInfoBar*) createDefaultInfoBar { + return [self createDefaultInfoBarWithHeight:kDefaultInfoBarHeight]; +} + +- (JBInfoBar*) createDefaultInfoBarWithHeight:(NSInteger)height { + CGRect frame = CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, height); + JBInfoBar *infoBar = [[[JBInfoBar alloc] initWithFrame:frame] autorelease]; + infoBar.tag = [[self class] defaultInfoBarTag]; + return infoBar; +} + +- (JBInfoBar*) getOrCreateInfoBar { + JBInfoBar *infoBar = self.infoBar; + if(!infoBar) { + infoBar = [self createDefaultInfoBar]; + [self insertInfoBar:infoBar]; + } + return infoBar; +} + + +#pragma mark Global Configuration + +static NSInteger defaultInfoBarTag = kDefaultUndefinedInfoBarTag; + ++ (void) setDefaultInfoBarTag:(NSInteger)tag { + defaultInfoBarTag = tag; +} + ++ (NSInteger) defaultInfoBarTag { + return defaultInfoBarTag; +} + +@end + + + + + + + + + + + + + + + diff --git a/InfoBar.xcodeproj/project.pbxproj b/InfoBar.xcodeproj/project.pbxproj index d0ba3eb..debe861 100644 --- a/InfoBar.xcodeproj/project.pbxproj +++ b/InfoBar.xcodeproj/project.pbxproj @@ -10,6 +10,9 @@ 5B5FB2811311514600719F62 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B5FB2801311514600719F62 /* UIKit.framework */; }; 5B5FB2831311514600719F62 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B5FB2821311514600719F62 /* Foundation.framework */; }; 5B5FB2851311514600719F62 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B5FB2841311514600719F62 /* CoreGraphics.framework */; }; + BF3AA0A71620FA6700A82B96 /* UIViewController+JBInfoBar.h in Headers */ = {isa = PBXBuildFile; fileRef = BF3AA0A61620FA6700A82B96 /* UIViewController+JBInfoBar.h */; }; + BF3AA0B31620FAE200A82B96 /* UITabBarController+JBInfoBar.h in Headers */ = {isa = PBXBuildFile; fileRef = BF3AA0B11620FAE100A82B96 /* UITabBarController+JBInfoBar.h */; }; + BF3AA0B41620FAE200A82B96 /* UITabBarController+JBInfoBar.m in Sources */ = {isa = PBXBuildFile; fileRef = BF3AA0B21620FAE100A82B96 /* UITabBarController+JBInfoBar.m */; }; BF7B4635153C6E1E00616962 /* FirstViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4620153C6E1E00616962 /* FirstViewController.m */; }; BF7B4637153C6E1E00616962 /* InfoBarAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4624153C6E1E00616962 /* InfoBarAppDelegate.m */; }; BF7B4638153C6E1E00616962 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4625153C6E1E00616962 /* main.m */; }; @@ -23,8 +26,7 @@ BF7B4658153C6FC600616962 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = BF7B4656153C6FC600616962 /* Icon@2x.png */; }; BF7B465E153C702900616962 /* libInfoBarStaticLibrary.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BF7B4646153C6EF300616962 /* libInfoBarStaticLibrary.a */; }; BF7B4662153C734700616962 /* JBInfoBar.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B4632153C6E1E00616962 /* JBInfoBar.m */; }; - BF7B466D153C860500616962 /* UITabBarController+JBInfoBar.h in Headers */ = {isa = PBXBuildFile; fileRef = BF7B466B153C860500616962 /* UITabBarController+JBInfoBar.h */; }; - BF7B466E153C860500616962 /* UITabBarController+JBInfoBar.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B466C153C860500616962 /* UITabBarController+JBInfoBar.m */; }; + BF7B466E153C860500616962 /* UIViewController+JBInfoBar.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B466C153C860500616962 /* UIViewController+JBInfoBar.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -42,6 +44,9 @@ 5B5FB2801311514600719F62 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 5B5FB2821311514600719F62 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 5B5FB2841311514600719F62 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + BF3AA0A61620FA6700A82B96 /* UIViewController+JBInfoBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+JBInfoBar.h"; sourceTree = ""; }; + BF3AA0B11620FAE100A82B96 /* UITabBarController+JBInfoBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITabBarController+JBInfoBar.h"; sourceTree = ""; }; + BF3AA0B21620FAE100A82B96 /* UITabBarController+JBInfoBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITabBarController+JBInfoBar.m"; sourceTree = ""; }; BF7B461F153C6E1E00616962 /* FirstViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FirstViewController.h; sourceTree = ""; }; BF7B4620153C6E1E00616962 /* FirstViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FirstViewController.m; sourceTree = ""; }; BF7B4621153C6E1E00616962 /* InfoBarDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "InfoBarDemo-Info.plist"; sourceTree = ""; }; @@ -61,8 +66,7 @@ BF7B4652153C6F6600616962 /* InfoBarStaticLibrary-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "InfoBarStaticLibrary-Prefix.pch"; sourceTree = ""; }; BF7B4655153C6FC600616962 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; BF7B4656153C6FC600616962 /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = ""; }; - BF7B466B153C860500616962 /* UITabBarController+JBInfoBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITabBarController+JBInfoBar.h"; sourceTree = ""; }; - BF7B466C153C860500616962 /* UITabBarController+JBInfoBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITabBarController+JBInfoBar.m"; sourceTree = ""; }; + BF7B466C153C860500616962 /* UIViewController+JBInfoBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+JBInfoBar.m"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -185,8 +189,10 @@ BF7B466A153C860500616962 /* UIKit Additions */ = { isa = PBXGroup; children = ( - BF7B466B153C860500616962 /* UITabBarController+JBInfoBar.h */, - BF7B466C153C860500616962 /* UITabBarController+JBInfoBar.m */, + BF3AA0A61620FA6700A82B96 /* UIViewController+JBInfoBar.h */, + BF7B466C153C860500616962 /* UIViewController+JBInfoBar.m */, + BF3AA0B11620FAE100A82B96 /* UITabBarController+JBInfoBar.h */, + BF3AA0B21620FAE100A82B96 /* UITabBarController+JBInfoBar.m */, ); path = "UIKit Additions"; sourceTree = ""; @@ -198,7 +204,8 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - BF7B466D153C860500616962 /* UITabBarController+JBInfoBar.h in Headers */, + BF3AA0A71620FA6700A82B96 /* UIViewController+JBInfoBar.h in Headers */, + BF3AA0B31620FAE200A82B96 /* UITabBarController+JBInfoBar.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -296,7 +303,8 @@ buildActionMask = 2147483647; files = ( BF7B4662153C734700616962 /* JBInfoBar.m in Sources */, - BF7B466E153C860500616962 /* UITabBarController+JBInfoBar.m in Sources */, + BF7B466E153C860500616962 /* UIViewController+JBInfoBar.m in Sources */, + BF3AA0B41620FAE200A82B96 /* UITabBarController+JBInfoBar.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };