Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Created repository

  • Loading branch information...
commit 261a2a0d2b8373c7c25429709b543a0132ce3cf0 0 parents
@brandonhamilton authored
Showing with 7,427 additions and 0 deletions.
  1. +21 −0 LICENSE.txt
  2. +8 −0 README.md
  3. BIN  Screenshot.png
  4. +339 −0 UIInputToolbarSample.xcodeproj/project.pbxproj
  5. +7 −0 UIInputToolbarSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  6. +5,576 −0 ...utToolbarSample.xcodeproj/project.xcworkspace/xcuserdata/brandon.xcuserdatad/UserInterfaceState.xcuserstate
  7. +63 −0 UIInputToolbarSample.xcodeproj/xcuserdata/brandon.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
  8. +76 −0 UIInputToolbarSample.xcodeproj/xcuserdata/brandon.xcuserdatad/xcschemes/UIInputToolbarSample.xcscheme
  9. +22 −0 UIInputToolbarSample.xcodeproj/xcuserdata/brandon.xcuserdatad/xcschemes/xcschememanagement.plist
  10. BIN  UIInputToolbarSample/.DS_Store
  11. +91 −0 UIInputToolbarSample/Classes/UIInputToolbar/UIExpandingTextView.h
  12. +439 −0 UIInputToolbarSample/Classes/UIInputToolbar/UIExpandingTextView.m
  13. +30 −0 UIInputToolbarSample/Classes/UIInputToolbar/UIExpandingTextViewInternal.h
  14. +62 −0 UIInputToolbarSample/Classes/UIInputToolbar/UIExpandingTextViewInternal.m
  15. +47 −0 UIInputToolbarSample/Classes/UIInputToolbar/UIInputToolbar.h
  16. +140 −0 UIInputToolbarSample/Classes/UIInputToolbar/UIInputToolbar.m
  17. +37 −0 UIInputToolbarSample/Classes/UIInputToolbarSampleAppDelegate.h
  18. +49 −0 UIInputToolbarSample/Classes/UIInputToolbarSampleAppDelegate.m
  19. +34 −0 UIInputToolbarSample/Classes/UIInputToolbarViewController.h
  20. +111 −0 UIInputToolbarSample/Classes/UIInputToolbarViewController.m
  21. BIN  UIInputToolbarSample/Resources/buttonbg@2x~iphone.png
  22. BIN  UIInputToolbarSample/Resources/buttonbg~iphone.png
  23. BIN  UIInputToolbarSample/Resources/textbg@2x~iphone.png
  24. BIN  UIInputToolbarSample/Resources/textbg~iphone.png
  25. BIN  UIInputToolbarSample/Resources/toolbarbg@2x~iphone.png
  26. BIN  UIInputToolbarSample/Resources/toolbarbg~iphone.png
  27. +44 −0 UIInputToolbarSample/UIInputToolbarSample-Info.plist
  28. +14 −0 UIInputToolbarSample/UIInputToolbarSample-Prefix.pch
  29. +2 −0  UIInputToolbarSample/en.lproj/InfoPlist.strings
  30. +198 −0 UIInputToolbarSample/en.lproj/MainWindow.xib
  31. +17 −0 UIInputToolbarSample/main.m
21 LICENSE.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2011 Brandon Hamilton
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
8 README.md
@@ -0,0 +1,8 @@
+# Messages style input toolbar for iOS
+
+An free version of an input toolbar in the style of the native iPhone messages app
+
+![InputToolbar screenshot][1]
+
+ [1]: https://github.com/brandonhamilton/inputtoolbar/raw/master/Screenshot.png
+
BIN  Screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
339 UIInputToolbarSample.xcodeproj/project.pbxproj
@@ -0,0 +1,339 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ CA3A7B9213708CDE00CF5E6B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA3A7B9113708CDE00CF5E6B /* UIKit.framework */; };
+ CA3A7B9413708CDE00CF5E6B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA3A7B9313708CDE00CF5E6B /* Foundation.framework */; };
+ CA3A7B9613708CDE00CF5E6B /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA3A7B9513708CDE00CF5E6B /* CoreGraphics.framework */; };
+ CA3A7B9C13708CDE00CF5E6B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = CA3A7B9A13708CDE00CF5E6B /* InfoPlist.strings */; };
+ CA3A7B9F13708CDE00CF5E6B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CA3A7B9E13708CDE00CF5E6B /* main.m */; };
+ CA3A7BA513708CDF00CF5E6B /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = CA3A7BA313708CDF00CF5E6B /* MainWindow.xib */; };
+ CAB6463213758821007B4CF0 /* UIExpandingTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = CAB6462913758821007B4CF0 /* UIExpandingTextView.m */; };
+ CAB6463313758821007B4CF0 /* UIExpandingTextViewInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = CAB6462B13758821007B4CF0 /* UIExpandingTextViewInternal.m */; };
+ CAB6463413758821007B4CF0 /* UIInputToolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = CAB6462D13758821007B4CF0 /* UIInputToolbar.m */; };
+ CAB6463513758821007B4CF0 /* UIInputToolbarSampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CAB6462F13758821007B4CF0 /* UIInputToolbarSampleAppDelegate.m */; };
+ CAB6463613758821007B4CF0 /* UIInputToolbarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CAB6463113758821007B4CF0 /* UIInputToolbarViewController.m */; };
+ CAB6463D13758836007B4CF0 /* buttonbg@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = CAB6463713758836007B4CF0 /* buttonbg@2x~iphone.png */; };
+ CAB6463E13758836007B4CF0 /* buttonbg~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = CAB6463813758836007B4CF0 /* buttonbg~iphone.png */; };
+ CAB6463F13758836007B4CF0 /* textbg@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = CAB6463913758836007B4CF0 /* textbg@2x~iphone.png */; };
+ CAB6464013758836007B4CF0 /* textbg~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = CAB6463A13758836007B4CF0 /* textbg~iphone.png */; };
+ CAB6464113758836007B4CF0 /* toolbarbg@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = CAB6463B13758836007B4CF0 /* toolbarbg@2x~iphone.png */; };
+ CAB6464213758836007B4CF0 /* toolbarbg~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = CAB6463C13758836007B4CF0 /* toolbarbg~iphone.png */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ CA3A7B8D13708CDE00CF5E6B /* UIInputToolbarSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIInputToolbarSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ CA3A7B9113708CDE00CF5E6B /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ CA3A7B9313708CDE00CF5E6B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ CA3A7B9513708CDE00CF5E6B /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ CA3A7B9913708CDE00CF5E6B /* UIInputToolbarSample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UIInputToolbarSample-Info.plist"; sourceTree = "<group>"; };
+ CA3A7B9B13708CDE00CF5E6B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ CA3A7B9D13708CDE00CF5E6B /* UIInputToolbarSample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIInputToolbarSample-Prefix.pch"; sourceTree = "<group>"; };
+ CA3A7B9E13708CDE00CF5E6B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ CA3A7BA413708CDF00CF5E6B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = "<group>"; };
+ CAB6462813758821007B4CF0 /* UIExpandingTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIExpandingTextView.h; sourceTree = "<group>"; };
+ CAB6462913758821007B4CF0 /* UIExpandingTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIExpandingTextView.m; sourceTree = "<group>"; };
+ CAB6462A13758821007B4CF0 /* UIExpandingTextViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIExpandingTextViewInternal.h; sourceTree = "<group>"; };
+ CAB6462B13758821007B4CF0 /* UIExpandingTextViewInternal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIExpandingTextViewInternal.m; sourceTree = "<group>"; };
+ CAB6462C13758821007B4CF0 /* UIInputToolbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIInputToolbar.h; sourceTree = "<group>"; };
+ CAB6462D13758821007B4CF0 /* UIInputToolbar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIInputToolbar.m; sourceTree = "<group>"; };
+ CAB6462E13758821007B4CF0 /* UIInputToolbarSampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIInputToolbarSampleAppDelegate.h; sourceTree = "<group>"; };
+ CAB6462F13758821007B4CF0 /* UIInputToolbarSampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIInputToolbarSampleAppDelegate.m; sourceTree = "<group>"; };
+ CAB6463013758821007B4CF0 /* UIInputToolbarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIInputToolbarViewController.h; sourceTree = "<group>"; };
+ CAB6463113758821007B4CF0 /* UIInputToolbarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIInputToolbarViewController.m; sourceTree = "<group>"; };
+ CAB6463713758836007B4CF0 /* buttonbg@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "buttonbg@2x~iphone.png"; path = "../../../iOS/UIInputToolbarSample/UIInputToolbarSample/Resources/buttonbg@2x~iphone.png"; sourceTree = "<group>"; };
+ CAB6463813758836007B4CF0 /* buttonbg~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "buttonbg~iphone.png"; path = "../../../iOS/UIInputToolbarSample/UIInputToolbarSample/Resources/buttonbg~iphone.png"; sourceTree = "<group>"; };
+ CAB6463913758836007B4CF0 /* textbg@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "textbg@2x~iphone.png"; path = "../../../iOS/UIInputToolbarSample/UIInputToolbarSample/Resources/textbg@2x~iphone.png"; sourceTree = "<group>"; };
+ CAB6463A13758836007B4CF0 /* textbg~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "textbg~iphone.png"; path = "../../../iOS/UIInputToolbarSample/UIInputToolbarSample/Resources/textbg~iphone.png"; sourceTree = "<group>"; };
+ CAB6463B13758836007B4CF0 /* toolbarbg@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "toolbarbg@2x~iphone.png"; path = "../../../iOS/UIInputToolbarSample/UIInputToolbarSample/Resources/toolbarbg@2x~iphone.png"; sourceTree = "<group>"; };
+ CAB6463C13758836007B4CF0 /* toolbarbg~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "toolbarbg~iphone.png"; path = "../../../iOS/UIInputToolbarSample/UIInputToolbarSample/Resources/toolbarbg~iphone.png"; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ CA3A7B8A13708CDE00CF5E6B /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ CA3A7B9213708CDE00CF5E6B /* UIKit.framework in Frameworks */,
+ CA3A7B9413708CDE00CF5E6B /* Foundation.framework in Frameworks */,
+ CA3A7B9613708CDE00CF5E6B /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ CA3A7B8213708CDE00CF5E6B = {
+ isa = PBXGroup;
+ children = (
+ CA3A7B9713708CDE00CF5E6B /* UIInputToolbarSample */,
+ CA3A7B9013708CDE00CF5E6B /* Frameworks */,
+ CA3A7B8E13708CDE00CF5E6B /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ CA3A7B8E13708CDE00CF5E6B /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ CA3A7B8D13708CDE00CF5E6B /* UIInputToolbarSample.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ CA3A7B9013708CDE00CF5E6B /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ CA3A7B9113708CDE00CF5E6B /* UIKit.framework */,
+ CA3A7B9313708CDE00CF5E6B /* Foundation.framework */,
+ CA3A7B9513708CDE00CF5E6B /* CoreGraphics.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ CA3A7B9713708CDE00CF5E6B /* UIInputToolbarSample */ = {
+ isa = PBXGroup;
+ children = (
+ CAB6462613758821007B4CF0 /* Classes */,
+ CA3A7BAC13708CF700CF5E6B /* Resources */,
+ CA3A7B9813708CDE00CF5E6B /* Supporting Files */,
+ );
+ path = UIInputToolbarSample;
+ sourceTree = "<group>";
+ };
+ CA3A7B9813708CDE00CF5E6B /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ CA3A7B9913708CDE00CF5E6B /* UIInputToolbarSample-Info.plist */,
+ CA3A7B9A13708CDE00CF5E6B /* InfoPlist.strings */,
+ CA3A7B9D13708CDE00CF5E6B /* UIInputToolbarSample-Prefix.pch */,
+ CA3A7B9E13708CDE00CF5E6B /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ CA3A7BAC13708CF700CF5E6B /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ CAB6463713758836007B4CF0 /* buttonbg@2x~iphone.png */,
+ CAB6463813758836007B4CF0 /* buttonbg~iphone.png */,
+ CAB6463913758836007B4CF0 /* textbg@2x~iphone.png */,
+ CAB6463A13758836007B4CF0 /* textbg~iphone.png */,
+ CAB6463B13758836007B4CF0 /* toolbarbg@2x~iphone.png */,
+ CAB6463C13758836007B4CF0 /* toolbarbg~iphone.png */,
+ CA3A7BA313708CDF00CF5E6B /* MainWindow.xib */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ CAB6462613758821007B4CF0 /* Classes */ = {
+ isa = PBXGroup;
+ children = (
+ CAB6462713758821007B4CF0 /* UIInputToolbar */,
+ CAB6462E13758821007B4CF0 /* UIInputToolbarSampleAppDelegate.h */,
+ CAB6462F13758821007B4CF0 /* UIInputToolbarSampleAppDelegate.m */,
+ CAB6463013758821007B4CF0 /* UIInputToolbarViewController.h */,
+ CAB6463113758821007B4CF0 /* UIInputToolbarViewController.m */,
+ );
+ name = Classes;
+ path = ../../../iOS/UIInputToolbarSample/UIInputToolbarSample/Classes;
+ sourceTree = "<group>";
+ };
+ CAB6462713758821007B4CF0 /* UIInputToolbar */ = {
+ isa = PBXGroup;
+ children = (
+ CAB6462813758821007B4CF0 /* UIExpandingTextView.h */,
+ CAB6462913758821007B4CF0 /* UIExpandingTextView.m */,
+ CAB6462A13758821007B4CF0 /* UIExpandingTextViewInternal.h */,
+ CAB6462B13758821007B4CF0 /* UIExpandingTextViewInternal.m */,
+ CAB6462C13758821007B4CF0 /* UIInputToolbar.h */,
+ CAB6462D13758821007B4CF0 /* UIInputToolbar.m */,
+ );
+ path = UIInputToolbar;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ CA3A7B8C13708CDE00CF5E6B /* UIInputToolbarSample */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = CA3A7BA813708CDF00CF5E6B /* Build configuration list for PBXNativeTarget "UIInputToolbarSample" */;
+ buildPhases = (
+ CA3A7B8913708CDE00CF5E6B /* Sources */,
+ CA3A7B8A13708CDE00CF5E6B /* Frameworks */,
+ CA3A7B8B13708CDE00CF5E6B /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = UIInputToolbarSample;
+ productName = UIInputToolbarSample;
+ productReference = CA3A7B8D13708CDE00CF5E6B /* UIInputToolbarSample.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ CA3A7B8413708CDE00CF5E6B /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = CA3A7B8713708CDE00CF5E6B /* Build configuration list for PBXProject "UIInputToolbarSample" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = CA3A7B8213708CDE00CF5E6B;
+ productRefGroup = CA3A7B8E13708CDE00CF5E6B /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ CA3A7B8C13708CDE00CF5E6B /* UIInputToolbarSample */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ CA3A7B8B13708CDE00CF5E6B /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ CA3A7B9C13708CDE00CF5E6B /* InfoPlist.strings in Resources */,
+ CA3A7BA513708CDF00CF5E6B /* MainWindow.xib in Resources */,
+ CAB6463D13758836007B4CF0 /* buttonbg@2x~iphone.png in Resources */,
+ CAB6463E13758836007B4CF0 /* buttonbg~iphone.png in Resources */,
+ CAB6463F13758836007B4CF0 /* textbg@2x~iphone.png in Resources */,
+ CAB6464013758836007B4CF0 /* textbg~iphone.png in Resources */,
+ CAB6464113758836007B4CF0 /* toolbarbg@2x~iphone.png in Resources */,
+ CAB6464213758836007B4CF0 /* toolbarbg~iphone.png in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ CA3A7B8913708CDE00CF5E6B /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ CA3A7B9F13708CDE00CF5E6B /* main.m in Sources */,
+ CAB6463213758821007B4CF0 /* UIExpandingTextView.m in Sources */,
+ CAB6463313758821007B4CF0 /* UIExpandingTextViewInternal.m in Sources */,
+ CAB6463413758821007B4CF0 /* UIInputToolbar.m in Sources */,
+ CAB6463513758821007B4CF0 /* UIInputToolbarSampleAppDelegate.m in Sources */,
+ CAB6463613758821007B4CF0 /* UIInputToolbarViewController.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ CA3A7B9A13708CDE00CF5E6B /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ CA3A7B9B13708CDE00CF5E6B /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+ CA3A7BA313708CDF00CF5E6B /* MainWindow.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ CA3A7BA413708CDF00CF5E6B /* en */,
+ );
+ name = MainWindow.xib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ CA3A7BA613708CDF00CF5E6B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = com.apple.compilers.llvmgcc42;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ CA3A7BA713708CDF00CF5E6B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_VERSION = com.apple.compilers.llvmgcc42;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ SDKROOT = iphoneos;
+ };
+ name = Release;
+ };
+ CA3A7BA913708CDF00CF5E6B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "UIInputToolbarSample/UIInputToolbarSample-Prefix.pch";
+ INFOPLIST_FILE = "UIInputToolbarSample/UIInputToolbarSample-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ CA3A7BAA13708CDF00CF5E6B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "UIInputToolbarSample/UIInputToolbarSample-Prefix.pch";
+ INFOPLIST_FILE = "UIInputToolbarSample/UIInputToolbarSample-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ VALIDATE_PRODUCT = YES;
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ CA3A7B8713708CDE00CF5E6B /* Build configuration list for PBXProject "UIInputToolbarSample" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ CA3A7BA613708CDF00CF5E6B /* Debug */,
+ CA3A7BA713708CDF00CF5E6B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ CA3A7BA813708CDF00CF5E6B /* Build configuration list for PBXNativeTarget "UIInputToolbarSample" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ CA3A7BA913708CDF00CF5E6B /* Debug */,
+ CA3A7BAA13708CDF00CF5E6B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = CA3A7B8413708CDE00CF5E6B /* Project object */;
+}
7 UIInputToolbarSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:UIInputToolbarSample.xcodeproj">
+ </FileRef>
+</Workspace>
5,576 ...oolbarSample.xcodeproj/project.xcworkspace/xcuserdata/brandon.xcuserdatad/UserInterfaceState.xcuserstate
5,576 additions, 0 deletions not shown
63 UIInputToolbarSample.xcodeproj/xcuserdata/brandon.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Bucket
+ type = "1"
+ version = "1.0">
+ <FileBreakpoints>
+ <FileBreakpoint
+ shouldBeEnabled = "No"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ isPathRelative = "1"
+ filePath = "UIInputToolbarSample/UIInputToolbar.m"
+ timestampString = "326468058.10614"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "29"
+ endingLineNumber = "29"
+ landmarkName = "@implementation UIInputToolbar"
+ landmarkType = "3">
+ </FileBreakpoint>
+ <FileBreakpoint
+ shouldBeEnabled = "No"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ isPathRelative = "1"
+ filePath = "UIInputToolbarSample/UIInputToolbar.m"
+ timestampString = "326464028.626806"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "17"
+ endingLineNumber = "17"
+ landmarkName = "-inputButtonPressed"
+ landmarkType = "5">
+ </FileBreakpoint>
+ <FileBreakpoint
+ shouldBeEnabled = "No"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ isPathRelative = "1"
+ filePath = "UIInputToolbarSample/UIExpandingTextView.h"
+ timestampString = "326467114.150143"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "56"
+ endingLineNumber = "56"
+ landmarkName = "minimumNumberOfLines"
+ landmarkType = "19">
+ </FileBreakpoint>
+ <FileBreakpoint
+ shouldBeEnabled = "No"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ isPathRelative = "1"
+ filePath = "UIInputToolbarSample/UIExpandingTextView.h"
+ timestampString = "326467115.061725"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "54"
+ endingLineNumber = "54"
+ landmarkName = "@interface UIExpandingTextView"
+ landmarkType = "2">
+ </FileBreakpoint>
+ </FileBreakpoints>
+</Bucket>
76 UIInputToolbarSample.xcodeproj/xcuserdata/brandon.xcuserdatad/xcschemes/UIInputToolbarSample.xcscheme
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "CA3A7B8C13708CDE00CF5E6B"
+ BuildableName = "UIInputToolbarSample.app"
+ BlueprintName = "UIInputToolbarSample"
+ ReferencedContainer = "container:UIInputToolbarSample.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ displayScaleIsEnabled = "NO"
+ displayScale = "1.00"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "CA3A7B8C13708CDE00CF5E6B"
+ BuildableName = "UIInputToolbarSample.app"
+ BlueprintName = "UIInputToolbarSample"
+ ReferencedContainer = "container:UIInputToolbarSample.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ displayScaleIsEnabled = "NO"
+ displayScale = "1.00"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "CA3A7B8C13708CDE00CF5E6B"
+ BuildableName = "UIInputToolbarSample.app"
+ BlueprintName = "UIInputToolbarSample"
+ ReferencedContainer = "container:UIInputToolbarSample.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
22 UIInputToolbarSample.xcodeproj/xcuserdata/brandon.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,22 @@
+<?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>UIInputToolbarSample.xcscheme</key>
+ <dict>
+ <key>orderHint</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <key>SuppressBuildableAutocreation</key>
+ <dict>
+ <key>CA3A7B8C13708CDE00CF5E6B</key>
+ <dict>
+ <key>primary</key>
+ <true/>
+ </dict>
+ </dict>
+</dict>
+</plist>
BIN  UIInputToolbarSample/.DS_Store
Binary file not shown
91 UIInputToolbarSample/Classes/UIInputToolbar/UIExpandingTextView.h
@@ -0,0 +1,91 @@
+/*
+ * UIExpandingTextView.h
+ *
+ * Created by Brandon Hamilton on 2011/05/03.
+ * Copyright 2011 Brandon Hamilton.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#import <UIKit/UIKit.h>
+#import "UIExpandingTextViewInternal.h"
+
+@class UIExpandingTextView;
+
+@protocol UIExpandingTextViewDelegate
+
+@optional
+- (BOOL)expandingTextViewShouldBeginEditing:(UIExpandingTextView *)expandingTextView;
+- (BOOL)expandingTextViewShouldEndEditing:(UIExpandingTextView *)expandingTextView;
+
+- (void)expandingTextViewDidBeginEditing:(UIExpandingTextView *)expandingTextView;
+- (void)expandingTextViewDidEndEditing:(UIExpandingTextView *)expandingTextView;
+
+- (BOOL)expandingTextView:(UIExpandingTextView *)expandingTextView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text;
+- (void)expandingTextViewDidChange:(UIExpandingTextView *)expandingTextView;
+
+- (void)expandingTextView:(UIExpandingTextView *)expandingTextView willChangeHeight:(float)height;
+- (void)expandingTextView:(UIExpandingTextView *)expandingTextView didChangeHeight:(float)height;
+
+- (void)expandingTextViewDidChangeSelection:(UIExpandingTextView *)expandingTextView;
+- (BOOL)expandingTextViewShouldReturn:(UIExpandingTextView *)expandingTextView;
+@end
+
+@interface UIExpandingTextView : UIView <UITextViewDelegate>
+{
+ UIExpandingTextViewInternal *internalTextView;
+ UIImageView *textViewBackgroundImage;
+ int minimumHeight;
+ int maximumHeight;
+ int maximumNumberOfLines;
+ int minimumNumberOfLines;
+ BOOL animateHeightChange;
+ NSObject <UIExpandingTextViewDelegate> *delegate;
+ NSString *text;
+ UIFont *font;
+ UIColor *textColor;
+ UITextAlignment textAlignment;
+ NSRange selectedRange;
+ BOOL editable;
+ UIDataDetectorTypes dataDetectorTypes;
+ UIReturnKeyType returnKeyType;
+}
+
+@property (nonatomic, retain) UITextView *internalTextView;
+
+@property int maximumNumberOfLines;
+@property int minimumNumberOfLines;
+@property BOOL animateHeightChange;
+
+@property (assign) NSObject<UIExpandingTextViewDelegate> *delegate;
+@property (nonatomic,assign) NSString *text;
+@property (nonatomic,assign) UIFont *font;
+@property (nonatomic,assign) UIColor *textColor;
+@property (nonatomic) UITextAlignment textAlignment;
+@property (nonatomic) NSRange selectedRange;
+@property (nonatomic,getter=isEditable) BOOL editable;
+@property (nonatomic) UIDataDetectorTypes dataDetectorTypes __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);
+@property (nonatomic) UIReturnKeyType returnKeyType;
+@property (nonatomic, retain) UIImageView *textViewBackgroundImage;
+
+- (BOOL)hasText;
+- (void)scrollRangeToVisible:(NSRange)range;
+- (void)clearText;
+
+@end
439 UIInputToolbarSample/Classes/UIInputToolbar/UIExpandingTextView.m
@@ -0,0 +1,439 @@
+/*
+ * UIExpandingTextView.m
+ *
+ * Created by Brandon Hamilton on 2011/05/03.
+ * Copyright 2011 Brandon Hamilton.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/*
+ * This class is based on growingTextView by Hans Pickaers
+ * http://www.hanspinckaers.com/multi-line-uitextview-similar-to-sms
+ */
+
+#import "UIExpandingTextView.h"
+
+#define kTextInsetX 4
+#define kTextInsetBottom 0
+
+@implementation UIExpandingTextView
+
+@synthesize internalTextView;
+@synthesize delegate;
+
+@synthesize text;
+@synthesize font;
+@synthesize textColor;
+@synthesize textAlignment;
+@synthesize selectedRange;
+@synthesize editable;
+@synthesize dataDetectorTypes;
+@synthesize animateHeightChange;
+@synthesize returnKeyType;
+@synthesize textViewBackgroundImage;
+
+- (int)minimumNumberOfLines
+{
+ return minimumNumberOfLines;
+}
+
+- (int)maximumNumberOfLines
+{
+ return maximumNumberOfLines;
+}
+
+- (id)initWithFrame:(CGRect)frame
+{
+ if ((self = [super initWithFrame:frame]))
+ {
+ CGRect backgroundFrame = frame;
+ backgroundFrame.origin.y = 0;
+ backgroundFrame.origin.x = 0;
+
+ CGRect textViewFrame = CGRectInset(backgroundFrame, kTextInsetX, 0);
+
+ /* Internal Text View component */
+ internalTextView = [[UIExpandingTextViewInternal alloc] initWithFrame:textViewFrame];
+ internalTextView.delegate = self;
+ internalTextView.font = [UIFont systemFontOfSize:15.0];
+ internalTextView.contentInset = UIEdgeInsetsMake(-4,0,-4,0);
+ internalTextView.text = @"-";
+ internalTextView.scrollEnabled = NO;
+ internalTextView.opaque = NO;
+ internalTextView.backgroundColor = [UIColor clearColor];
+ internalTextView.showsHorizontalScrollIndicator = NO;
+ [internalTextView sizeToFit];
+
+ /* Custom Background image */
+ textViewBackgroundImage = [[UIImageView alloc] initWithFrame:backgroundFrame];
+ textViewBackgroundImage.image = [UIImage imageNamed:@"textbg"];
+ textViewBackgroundImage.contentMode = UIViewContentModeScaleToFill;
+ textViewBackgroundImage.contentStretch = CGRectMake(0.5, 0.5, 0, 0);
+
+ [self addSubview:textViewBackgroundImage];
+ [self addSubview:internalTextView];
+
+ /* Calculate the text view height */
+ UIView *internal = (UIView*)[[internalTextView subviews] objectAtIndex:0];
+ minimumHeight = internal.frame.size.height;
+ [self setMinimumNumberOfLines:1];
+ animateHeightChange = YES;
+ internalTextView.text = @"";
+ [self setMaximumNumberOfLines:4];
+ [self sizeToFit];
+ }
+ return self;
+}
+
+-(void)sizeToFit
+{
+ CGRect r = self.frame;
+ if ([self.text length] > 0)
+ {
+ /* No need to resize is text is not empty */
+ return;
+ }
+ r.size.height = minimumHeight + kTextInsetBottom;
+ self.frame = r;
+}
+
+-(void)setFrame:(CGRect)aframe
+{
+ CGRect backgroundFrame = aframe;
+ backgroundFrame.origin.y = 0;
+ backgroundFrame.origin.x = 0;
+ CGRect textViewFrame = CGRectInset(backgroundFrame, kTextInsetX, 0);
+ internalTextView.frame = textViewFrame;
+ backgroundFrame.size.height -= 8;
+ textViewBackgroundImage.frame = backgroundFrame;
+ [super setFrame:aframe];
+}
+
+-(void)clearText
+{
+ self.text = @"";
+ [self textViewDidChange:self.internalTextView];
+}
+
+-(void)setMaximumNumberOfLines:(int)n
+{
+ NSString *saveText = internalTextView.text;
+ NSString *newText = @"-";
+ internalTextView.hidden = YES;
+ internalTextView.delegate = nil;
+ for (int i = 2; i < n; ++i)
+ {
+ newText = [newText stringByAppendingString:@"\n|W|"];
+ }
+ internalTextView.text = newText;
+ maximumHeight = internalTextView.contentSize.height;
+ maximumNumberOfLines = n;
+ internalTextView.text = saveText;
+ internalTextView.hidden = NO;
+ internalTextView.delegate = self;
+}
+
+-(void)setMinimumNumberOfLines:(int)m
+{
+ NSString *saveText = internalTextView.text;
+ NSString *newText = @"-";
+ internalTextView.hidden = YES;
+ internalTextView.delegate = nil;
+ for (int i = 2; i < m; ++i)
+ {
+ newText = [newText stringByAppendingString:@"\n|W|"];
+ }
+ internalTextView.text = newText;
+ minimumHeight = internalTextView.contentSize.height;
+ internalTextView.text = saveText;
+ internalTextView.hidden = NO;
+ internalTextView.delegate = self;
+ [self sizeToFit];
+ minimumNumberOfLines = m;
+}
+
+
+- (void)textViewDidChange:(UITextView *)textView
+{
+ NSInteger newHeight = internalTextView.contentSize.height;
+
+ if(newHeight < minimumHeight || !internalTextView.hasText)
+ {
+ newHeight = minimumHeight;
+ }
+
+ if (internalTextView.frame.size.height != newHeight)
+ {
+ if (newHeight > maximumHeight && internalTextView.frame.size.height <= maximumHeight)
+ {
+ newHeight = maximumHeight;
+ }
+
+ if (newHeight <= maximumHeight)
+ {
+ if(animateHeightChange)
+ {
+ [UIView beginAnimations:@"" context:nil];
+ [UIView setAnimationDelegate:self];
+ [UIView setAnimationDidStopSelector:@selector(growDidStop)];
+ [UIView setAnimationBeginsFromCurrentState:YES];
+ }
+
+ if ([delegate respondsToSelector:@selector(expandingTextView:willChangeHeight:)])
+ {
+ [delegate expandingTextView:self willChangeHeight:(newHeight+ kTextInsetBottom)];
+ }
+
+ /* Resize the frame */
+ CGRect r = self.frame;
+ r.size.height = newHeight + kTextInsetBottom;
+ self.frame = r;
+ r.origin.y = 0;
+ r.origin.x = 0;
+ internalTextView.frame = CGRectInset(r, kTextInsetX, 0);
+ r.size.height -= 8;
+ textViewBackgroundImage.frame = r;
+
+ if(animateHeightChange)
+ {
+ [UIView commitAnimations];
+ }
+ else if ([delegate respondsToSelector:@selector(expandingTextView:didChangeHeight:)])
+ {
+ [delegate expandingTextView:self didChangeHeight:(newHeight+ kTextInsetBottom)];
+ }
+ }
+
+ if (newHeight >= maximumHeight)
+ {
+ /* Enable vertical scrolling */
+ if(!internalTextView.scrollEnabled)
+ {
+ internalTextView.scrollEnabled = YES;
+ [internalTextView flashScrollIndicators];
+ }
+ }
+ else
+ {
+ /* Disable vertical scrolling */
+ internalTextView.scrollEnabled = NO;
+ }
+ }
+
+ if ([delegate respondsToSelector:@selector(expandingTextViewDidChange:)])
+ {
+ [delegate expandingTextViewDidChange:self];
+ }
+
+}
+
+-(void)growDidStop
+{
+ if ([delegate respondsToSelector:@selector(expandingTextView:didChangeHeight:)])
+ {
+ [delegate expandingTextView:self didChangeHeight:self.frame.size.height];
+ }
+}
+
+-(BOOL)resignFirstResponder
+{
+ [super resignFirstResponder];
+ return [internalTextView resignFirstResponder];
+}
+
+- (void)dealloc
+{
+ [internalTextView release];
+ [textViewBackgroundImage release];
+ [super dealloc];
+}
+
+#pragma mark UITextView properties
+
+-(void)setText:(NSString *)atext
+{
+ internalTextView.text = atext;
+ [self performSelector:@selector(textViewDidChange:) withObject:internalTextView];
+}
+
+-(NSString*)text
+{
+ return internalTextView.text;
+}
+
+-(void)setFont:(UIFont *)afont
+{
+ internalTextView.font= afont;
+ [self setMaximumNumberOfLines:maximumNumberOfLines];
+ [self setMinimumNumberOfLines:minimumNumberOfLines];
+}
+
+-(UIFont *)font
+{
+ return internalTextView.font;
+}
+
+-(void)setTextColor:(UIColor *)color
+{
+ internalTextView.textColor = color;
+}
+
+-(UIColor*)textColor
+{
+ return internalTextView.textColor;
+}
+
+-(void)setTextAlignment:(UITextAlignment)aligment
+{
+ internalTextView.textAlignment = aligment;
+}
+
+-(UITextAlignment)textAlignment
+{
+ return internalTextView.textAlignment;
+}
+
+-(void)setSelectedRange:(NSRange)range
+{
+ internalTextView.selectedRange = range;
+}
+
+-(NSRange)selectedRange
+{
+ return internalTextView.selectedRange;
+}
+
+-(void)setEditable:(BOOL)beditable
+{
+ internalTextView.editable = beditable;
+}
+
+-(BOOL)isEditable
+{
+ return internalTextView.editable;
+}
+
+-(void)setReturnKeyType:(UIReturnKeyType)keyType
+{
+ internalTextView.returnKeyType = keyType;
+}
+
+-(UIReturnKeyType)returnKeyType
+{
+ return internalTextView.returnKeyType;
+}
+
+-(void)setDataDetectorTypes:(UIDataDetectorTypes)datadetector
+{
+ internalTextView.dataDetectorTypes = datadetector;
+}
+
+-(UIDataDetectorTypes)dataDetectorTypes
+{
+ return internalTextView.dataDetectorTypes;
+}
+
+- (BOOL)hasText
+{
+ return [internalTextView hasText];
+}
+
+- (void)scrollRangeToVisible:(NSRange)range
+{
+ [internalTextView scrollRangeToVisible:range];
+}
+
+#pragma mark -
+#pragma mark UIExpandingTextViewDelegate
+
+- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
+{
+ if ([delegate respondsToSelector:@selector(expandingTextViewShouldBeginEditing:)])
+ {
+ return [delegate expandingTextViewShouldBeginEditing:self];
+ }
+ else
+ {
+ return YES;
+ }
+}
+
+- (BOOL)textViewShouldEndEditing:(UITextView *)textView
+{
+ if ([delegate respondsToSelector:@selector(expandingTextViewShouldEndEditing:)])
+ {
+ return [delegate expandingTextViewShouldEndEditing:self];
+ }
+ else
+ {
+ return YES;
+ }
+}
+
+- (void)textViewDidBeginEditing:(UITextView *)textView
+{
+ if ([delegate respondsToSelector:@selector(expandingTextViewDidBeginEditing:)])
+ {
+ [delegate expandingTextViewDidBeginEditing:self];
+ }
+}
+
+- (void)textViewDidEndEditing:(UITextView *)textView
+{
+ if ([delegate respondsToSelector:@selector(expandingTextViewDidEndEditing:)])
+ {
+ [delegate expandingTextViewDidEndEditing:self];
+ }
+}
+
+- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)atext
+{
+ if(![textView hasText] && [atext isEqualToString:@""])
+ {
+ return NO;
+ }
+
+ if ([atext isEqualToString:@"\n"])
+ {
+ if ([delegate respondsToSelector:@selector(expandingTextViewShouldReturn:)])
+ {
+ if (![delegate performSelector:@selector(expandingTextViewShouldReturn:) withObject:self])
+ {
+ return YES;
+ }
+ else
+ {
+ [textView resignFirstResponder];
+ return NO;
+ }
+ }
+ }
+ return YES;
+}
+
+- (void)textViewDidChangeSelection:(UITextView *)textView
+{
+ if ([delegate respondsToSelector:@selector(expandingTextViewDidChangeSelection:)])
+ {
+ [delegate expandingTextViewDidChangeSelection:self];
+ }
+}
+
+@end
30 UIInputToolbarSample/Classes/UIInputToolbar/UIExpandingTextViewInternal.h
@@ -0,0 +1,30 @@
+/*
+ * UIExpandingTextViewInternal.h
+ *
+ * Created by Brandon Hamilton on 2011/05/03.
+ * Copyright 2011 Brandon Hamilton.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#import <UIKit/UIKit.h>
+
+@interface UIExpandingTextViewInternal : UITextView { }
+
+@end
62 UIInputToolbarSample/Classes/UIInputToolbar/UIExpandingTextViewInternal.m
@@ -0,0 +1,62 @@
+/*
+ * UIExpandingTextViewInternal.m
+ *
+ * Created by Brandon Hamilton on 2011/05/03.
+ * Copyright 2011 Brandon Hamilton.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#import "UIExpandingTextViewInternal.h"
+
+#define kTopContentInset -4
+#define lBottonContentInset 12
+
+@implementation UIExpandingTextViewInternal
+
+-(void)setContentOffset:(CGPoint)s
+{
+ /* Check if user scrolled */
+ if(self.tracking || self.decelerating)
+ {
+ self.contentInset = UIEdgeInsetsMake(kTopContentInset, 0, 0, 0);
+ }
+ else
+ {
+ float bottomContentOffset = (self.contentSize.height - self.frame.size.height + self.contentInset.bottom);
+ if(s.y < bottomContentOffset && self.scrollEnabled)
+ {
+ self.contentInset = UIEdgeInsetsMake(kTopContentInset, 0, lBottonContentInset, 0);
+ }
+ }
+ [super setContentOffset:s];
+}
+
+-(void)setContentInset:(UIEdgeInsets)s
+{
+ UIEdgeInsets edgeInsets = s;
+ edgeInsets.top = kTopContentInset;
+ if(s.bottom > 12)
+ {
+ edgeInsets.bottom = 4;
+ }
+ [super setContentInset:edgeInsets];
+}
+
+@end
47 UIInputToolbarSample/Classes/UIInputToolbar/UIInputToolbar.h
@@ -0,0 +1,47 @@
+/*
+ * UIInputToolbar.h
+ *
+ * Created by Brandon Hamilton on 2011/05/03.
+ * Copyright 2011 Brandon Hamilton.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#import <UIKit/UIKit.h>
+#import "UIExpandingTextView.h"
+
+@protocol UIInputToolbarDelegate <NSObject>
+@optional
+-(void)inputButtonPressed:(NSString *)inputText;
+@end
+
+@interface UIInputToolbar : UIToolbar <UIExpandingTextViewDelegate>
+{
+ UIExpandingTextView *textView;
+ UIBarButtonItem *inputButton;
+ NSObject <UIInputToolbarDelegate> *delegate;
+}
+
+- (void)drawRect:(CGRect)rect;
+
+@property (nonatomic, retain) UIExpandingTextView *textView;
+@property (nonatomic, retain) UIBarButtonItem *inputButton;
+@property (assign) NSObject<UIInputToolbarDelegate> *delegate;
+
+@end
140 UIInputToolbarSample/Classes/UIInputToolbar/UIInputToolbar.m
@@ -0,0 +1,140 @@
+/*
+ * UIInputToolbar.m
+ *
+ * Created by Brandon Hamilton on 2011/05/03.
+ * Copyright 2011 Brandon Hamilton.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#import "UIInputToolbar.h"
+
+@implementation UIInputToolbar
+
+@synthesize textView;
+@synthesize inputButton;
+@synthesize delegate;
+
+-(void)inputButtonPressed
+{
+ if ([delegate respondsToSelector:@selector(inputButtonPressed:)])
+ {
+ [delegate inputButtonPressed:self.textView.text];
+ }
+
+ /* Remove the keyboard and clear the text */
+ [self.textView resignFirstResponder];
+ [self.textView clearText];
+}
+
+-(void)setupToolbar:(NSString *)buttonLabel
+{
+ self.tintColor = [UIColor lightGrayColor];
+
+ /* Create custom send button*/
+ UIImage *buttonImage = [UIImage imageNamed:@"buttonbg.png"];
+ buttonImage = [buttonImage stretchableImageWithLeftCapWidth:floorf(buttonImage.size.width/2) topCapHeight:floorf(buttonImage.size.height/2)];
+
+ UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
+ button.titleLabel.font = [UIFont boldSystemFontOfSize:15.0f];
+ button.titleLabel.shadowOffset = CGSizeMake(0, -1);
+ button.titleEdgeInsets = UIEdgeInsetsMake(0, 2, 0, 2);
+ button.contentStretch = CGRectMake(0.5, 0.5, 0, 0);
+ button.contentMode = UIViewContentModeScaleToFill;
+
+ [button setBackgroundImage:buttonImage forState:UIControlStateNormal];
+ [button setTitle:buttonLabel forState:UIControlStateNormal];
+ [button addTarget:self action:@selector(inputButtonPressed) forControlEvents:UIControlEventTouchDown];
+ [button sizeToFit];
+
+ self.inputButton = [[UIBarButtonItem alloc] initWithCustomView:button];
+ /* Disable button initially */
+ self.inputButton.enabled = NO;
+
+ /* Create UIExpandingTextView input */
+ self.textView = [[UIExpandingTextView alloc] initWithFrame:CGRectMake(7, 7, 236, 26)];
+ self.textView.delegate = self;
+
+ [self addSubview:self.textView];
+
+ /* Right align the toolbar button */
+ UIBarButtonItem *flexItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil] autorelease];
+ NSArray *items = [NSArray arrayWithObjects: flexItem, self.inputButton, nil];
+ [self setItems:items animated:NO];
+}
+
+-(id)initWithFrame:(CGRect)frame
+{
+ self = [super initWithFrame:frame];
+ [self setupToolbar:@"Send"];
+ return self;
+}
+
+-(id)init
+{
+ self = [super init];
+ [self setupToolbar:@"Send"];
+ return self;
+}
+
+- (void)drawRect:(CGRect)rect
+{
+ /* Draw custon toolbar background */
+ UIImage *backgroundImage = [UIImage imageNamed:@"toolbarbg.png"];
+ backgroundImage = [backgroundImage stretchableImageWithLeftCapWidth:floorf(backgroundImage.size.width/2) topCapHeight:floorf(backgroundImage.size.height/2)];
+ [backgroundImage drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
+}
+
+- (void)dealloc
+{
+ [textView release];
+ [inputButton release];
+ [super dealloc];
+}
+
+#pragma mark -
+#pragma mark UIExpandingTextView delegate
+
+-(void)expandingTextView:(UIExpandingTextView *)expandingTextView willChangeHeight:(float)height
+{
+ /* Adjust the height of the toolbar when the input component expands */
+ float diff = (textView.frame.size.height - height);
+ CGRect r = self.frame;
+ r.origin.y += diff;
+ r.size.height -= diff;
+ self.frame = r;
+}
+
+-(void)expandingTextViewDidChange:(UIExpandingTextView *)expandingTextView
+{
+ /* Enable/Disable the button */
+ if ([expandingTextView.text length] > 0)
+ self.inputButton.enabled = YES;
+ else
+ self.inputButton.enabled = NO;
+
+ /* Vertically align the button to the bottom of the toolbar */
+ CGRect i = self.inputButton.customView.frame;
+ i.origin.y = self.frame.size.height - i.size.height - 7;
+ self.inputButton.customView.frame = i;
+ [self.inputButton.customView setNeedsDisplay];
+ [self setNeedsDisplay];
+}
+
+@end
37 UIInputToolbarSample/Classes/UIInputToolbarSampleAppDelegate.h
@@ -0,0 +1,37 @@
+/*
+ * UIInputToolbarSampleAppDelegate.h
+ *
+ * Created by Brandon Hamilton on 2011/05/03.
+ * Copyright 2011 Brandon Hamilton.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#import <UIKit/UIKit.h>
+#import "UIInputToolbarViewController.h"
+
+@interface UIInputToolbarSampleAppDelegate : NSObject <UIApplicationDelegate>
+{
+ UIInputToolbarViewController *viewController;
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+@property (nonatomic, retain) UIInputToolbarViewController *viewController;
+
+@end
49 UIInputToolbarSample/Classes/UIInputToolbarSampleAppDelegate.m
@@ -0,0 +1,49 @@
+/*
+ * UIInputToolbarSampleAppDelegate.m
+ *
+ * Created by Brandon Hamilton on 2011/05/03.
+ * Copyright 2011 Brandon Hamilton.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#import "UIInputToolbarSampleAppDelegate.h"
+
+@implementation UIInputToolbarSampleAppDelegate
+
+
+@synthesize window=_window;
+@synthesize viewController;
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ self.viewController = [UIInputToolbarViewController alloc];
+ [self.window addSubview:self.viewController.view];
+ [self.window makeKeyAndVisible];
+ return YES;
+}
+
+- (void)dealloc
+{
+ [viewController release];
+ [_window release];
+ [super dealloc];
+}
+
+@end
34 UIInputToolbarSample/Classes/UIInputToolbarViewController.h
@@ -0,0 +1,34 @@
+/*
+ * UIInputToolbarViewController.h
+ *
+ * Created by Brandon Hamilton on 2011/05/03.
+ * Copyright 2011 Brandon Hamilton.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#import <UIKit/UIKit.h>
+#import "UIInputToolbar.h"
+
+@interface UIInputToolbarViewController : UIViewController <UIInputToolbarDelegate> {
+ UIInputToolbar *inputToolbar;
+}
+
+@property (nonatomic, retain) UIInputToolbar *inputToolbar;
+@end
111 UIInputToolbarSample/Classes/UIInputToolbarViewController.m
@@ -0,0 +1,111 @@
+/*
+ * UIInputToolbarViewController.m
+ *
+ * Created by Brandon Hamilton on 2011/05/03.
+ * Copyright 2011 Brandon Hamilton.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#import "UIInputToolbarViewController.h"
+
+#define kDefaultToolbarHeight 40
+
+@implementation UIInputToolbarViewController
+
+@synthesize inputToolbar;
+
+- (void)dealloc
+{
+ [inputToolbar release];
+ [super dealloc];
+}
+
+#pragma mark - View lifecycle
+
+- (void)loadView
+{
+ /* Calculate screen size */
+ CGRect screenFrame = [[UIScreen mainScreen] applicationFrame];
+ self.view = [[UIView alloc] initWithFrame:screenFrame];
+ self.view.backgroundColor = [UIColor whiteColor];
+
+ /* Create toolbar */
+ self.inputToolbar = [[UIInputToolbar alloc] initWithFrame:CGRectMake(0, screenFrame.size.height-kDefaultToolbarHeight, screenFrame.size.width, kDefaultToolbarHeight)];
+ [self.view addSubview:self.inputToolbar];
+ inputToolbar.delegate = self;
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+}
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+ /* Listen for keyboard */
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
+}
+
+- (void)viewWillDisappear:(BOOL)animated
+{
+ [super viewWillDisappear:animated];
+ /* No longer listen for keyboard */
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
+}
+
+#pragma mark -
+#pragma mark Notifications
+
+- (void)keyboardWillShow:(NSNotification *)notification
+{
+ /* Move the toolbar to above the keyboard */
+ [UIView beginAnimations:nil context:NULL];
+ [UIView setAnimationDuration:0.3];
+ CGRect frame = self.inputToolbar.frame;
+ frame.origin.y = self.view.frame.size.height - 256.0;
+ self.inputToolbar.frame = frame;
+ [UIView commitAnimations];
+}
+
+- (void)keyboardWillHide:(NSNotification *)notification
+{
+ /* Move the toolbar back to bottom of the screen */
+ [UIView beginAnimations:nil context:NULL];
+ [UIView setAnimationDuration:0.3];
+ CGRect frame = self.inputToolbar.frame;
+ frame.origin.y = self.view.frame.size.height - frame.size.height;
+ self.inputToolbar.frame = frame;
+ [UIView commitAnimations];
+}
+
+-(void)inputButtonPressed:(NSString *)inputText
+{
+ /* Called when toolbar button is pressed */
+ NSLog(@"Pressed button with text: '%@'", inputText);
+}
+@end
BIN  UIInputToolbarSample/Resources/buttonbg@2x~iphone.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  UIInputToolbarSample/Resources/buttonbg~iphone.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  UIInputToolbarSample/Resources/textbg@2x~iphone.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  UIInputToolbarSample/Resources/textbg~iphone.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  UIInputToolbarSample/Resources/toolbarbg@2x~iphone.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  UIInputToolbarSample/Resources/toolbarbg~iphone.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 UIInputToolbarSample/UIInputToolbarSample-Info.plist
@@ -0,0 +1,44 @@
+<?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>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleDocumentTypes</key>
+ <array/>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>Brandon-Hamilton.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleURLTypes</key>
+ <array/>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSMainNibFile</key>
+ <string>MainWindow</string>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ </array>
+ <key>UTExportedTypeDeclarations</key>
+ <array/>
+ <key>UTImportedTypeDeclarations</key>
+ <array/>
+</dict>
+</plist>
14 UIInputToolbarSample/UIInputToolbarSample-Prefix.pch
@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'UIInputToolbarSample' target in the 'UIInputToolbarSample' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_3_0
+#warning "This project uses features only available in iPhone SDK 3.0 and later."
+#endif
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
2  UIInputToolbarSample/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
198 UIInputToolbarSample/en.lproj/MainWindow.xib
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">800</int>
+ <string key="IBDocument.SystemVersion">10D540</string>
+ <string key="IBDocument.InterfaceBuilderVersion">760</string>
+ <string key="IBDocument.AppKitVersion">1038.29</string>
+ <string key="IBDocument.HIToolboxVersion">460.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">81</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="2"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="841351856">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="427554174">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUICustomObject" id="664661524">
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIWindow" id="380026005">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">1316</int>
+ <object class="NSPSMatrix" key="NSFrameMatrix"/>
+ <string key="NSFrameSize">{320, 480}</string>
+ <reference key="NSSuperview"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MSAxIDEAA</bytes>
+ </object>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBUIResizesToFullScreen">YES</bool>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="841351856"/>
+ <reference key="destination" ref="664661524"/>
+ </object>
+ <int key="connectionID">4</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">window</string>
+ <reference key="source" ref="664661524"/>
+ <reference key="destination" ref="380026005"/>
+ </object>
+ <int key="connectionID">5</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">2</int>
+ <reference key="object" ref="380026005"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="841351856"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">3</int>
+ <reference key="object" ref="664661524"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="427554174"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>2.IBAttributePlaceholdersKey</string>
+ <string>2.IBEditorWindowLastContentRect</string>
+ <string>2.IBPluginDependency</string>
+ <string>3.CustomClassName</string>
+ <string>3.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>UIApplication</string>
+ <string>UIResponder</string>
+ <object class="NSMutableDictionary">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <string>{{198, 376}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>UIInputToolbarSampleAppDelegate</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">9</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIInputToolbarSampleAppDelegate</string>
+ <string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">window</string>
+ <string key="NS.object.0">UIWindow</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">UIInputToolbarSampleAppDelegate.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIInputToolbarSampleAppDelegate</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3100" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <string key="IBDocument.LastKnownRelativeProjectPath">UIInputToolbarSample.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">81</string>
+ </data>
+</archive>
17 UIInputToolbarSample/main.m
@@ -0,0 +1,17 @@
+//
+// main.m
+// UIInputToolbarSample
+//
+// Created by Brandon Hamilton on 2011/05/03.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+int main(int argc, char *argv[])
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, nil);
+ [pool release];
+ return retVal;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.