Added a basic input accessory view, and a (nonfunctional) base button class.
14 files changed, 217 lines added, 0 lines removed
Changes
--- iOS/Genesis/Genesis.xcodeproj/project.pbxproj 69d3e39a2149f96bdc19a21258dfe72e06156941
+++ iOS/Genesis/Genesis.xcodeproj/project.pbxproj db6cac2d4c75c984244c49a223cc03c0f11d0731
@@ -152,6 +152,8 @@
+ 4FD1C2DA153C889100DD4A3D /* GNTextInputAccessoryView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD1C2D9153C889100DD4A3D /* GNTextInputAccessoryView.m */; };+ 4FD1C2DF153C891300DD4A3D /* GNTextInputAccessoryViewButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD1C2DE153C891300DD4A3D /* GNTextInputAccessoryViewButton.m */; };@@ -470,6 +472,10 @@
+ 4FD1C2D8153C889100DD4A3D /* GNTextInputAccessoryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GNTextInputAccessoryView.h; sourceTree = "<group>"; };+ 4FD1C2D9153C889100DD4A3D /* GNTextInputAccessoryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GNTextInputAccessoryView.m; sourceTree = "<group>"; };+ 4FD1C2DD153C891300DD4A3D /* GNTextInputAccessoryViewButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GNTextInputAccessoryViewButton.h; sourceTree = "<group>"; };+ 4FD1C2DE153C891300DD4A3D /* GNTextInputAccessoryViewButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GNTextInputAccessoryViewButton.m; sourceTree = "<group>"; };@@ -970,6 +976,25 @@
+ 4FD1C2DC153C889800DD4A3D /* Input Accessory View */ = {+ isa = PBXGroup;
+ children = (
+ 4FD1C2D8153C889100DD4A3D /* GNTextInputAccessoryView.h */,
+ 4FD1C2D9153C889100DD4A3D /* GNTextInputAccessoryView.m */,
+ 4FD1C2E0153C891600DD4A3D /* Buttons */,
+ );
+ name = "Input Accessory View";
+ sourceTree = "<group>";
+ };
+ 4FD1C2E0153C891600DD4A3D /* Buttons */ = {+ isa = PBXGroup;
+ children = (
+ 4FD1C2DD153C891300DD4A3D /* GNTextInputAccessoryViewButton.h */,
+ 4FD1C2DE153C891300DD4A3D /* GNTextInputAccessoryViewButton.m */,
+ );
+ name = Buttons;
+ sourceTree = "<group>";
+ };
@@ -1007,6 +1032,7 @@
+ 4FD1C2DC153C889800DD4A3D /* Input Accessory View */,
@@ -1171,6 +1197,8 @@
+ 4FD1C2DA153C889100DD4A3D /* GNTextInputAccessoryView.m in Sources */,
+ 4FD1C2DF153C891300DD4A3D /* GNTextInputAccessoryViewButton.m in Sources */,
--- iOS/Genesis/Genesis/GNTextInputAccessoryView.h 69d3e39a2149f96bdc19a21258dfe72e06156941
+++ iOS/Genesis/Genesis/GNTextInputAccessoryView.h db6cac2d4c75c984244c49a223cc03c0f11d0731
@@ -1,0 +1,41 @@
+/* Copyright (c) 2012, individual contributors
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#import <UIKit/UIKit.h>
+#import <QuartzCore/QuartzCore.h>
+
+#define kGNTextInputAccessoryViewHeightTall 25
+#define kGNTextInputAccessoryViewHeightShort 25
+#define kGNTextInputAccessoryStartingGradientColor [[UIColor colorWithRed:143/255.0 green:150/255.0 blue:159/255.0 alpha:1.0] CGColor]
+#define kGNTextInputAccessoryEndingGradientColor [[UIColor colorWithRed:153/255.0 green:160/255.0 blue:169/255.0 alpha:1.0] CGColor]
+#define kGNTextInputAccessoryGradientColors [NSArray arrayWithObjects:(id)kGNTextInputAccessoryStartingGradientColor, (id)kGNTextInputAccessoryEndingGradientColor, nil]
+
+@protocol GNTextInputAccessoryViewDelegate <NSObject>
+
+-(void)dismissKeyboard;
+
+@end
+
+@interface GNTextInputAccessoryView : UIView
+{+ CAGradientLayer* gradientLayer;
+
+ NSObject<GNTextInputAccessoryViewDelegate>* delegate;
+}
+
+-(id)initWithDelegate:(NSObject<GNTextInputAccessoryViewDelegate>*)inputDelegate;
+-(void)cleanUp;
+
+@end
--- iOS/Genesis/Genesis/GNTextInputAccessoryView.m 69d3e39a2149f96bdc19a21258dfe72e06156941
+++ iOS/Genesis/Genesis/GNTextInputAccessoryView.m db6cac2d4c75c984244c49a223cc03c0f11d0731
@@ -1,0 +1,76 @@
+/* Copyright (c) 2012, individual contributors
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#import "GNTextInputAccessoryView.h"
+
+@implementation GNTextInputAccessoryView
+
+-(id)initWithDelegate:(NSObject<GNTextInputAccessoryViewDelegate>*)inputDelegate
+{+ self = [super initWithFrame:CGRectMake(0,
+ 0,
+ [[UIScreen mainScreen] bounds].size.width,
+ [self appropriateHeight])];
+ if(self)
+ {+ delegate = inputDelegate;
+
+
+ // Observe keyboard events
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(keyboardChanged:)
+ name:UIKeyboardWillShowNotification
+ object:nil];
+
+ // Set our autoresize mask
+ [self setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
+
+ // Create our gradient layer
+ gradientLayer = [CAGradientLayer layer];
+ [gradientLayer setFrame:[self frame]];
+ [gradientLayer setColors:kGNTextInputAccessoryGradientColors];
+ [[self layer] addSublayer:gradientLayer];
+ }
+
+ return self;
+}
+
+-(void)keyboardChanged:(id)object
+{+ [gradientLayer setFrame:[self frame]];
+}
+
+-(CGFloat)appropriateHeight
+{+ // Grab the device interface idiom
+ UIUserInterfaceIdiom interfaceIdiom = [[UIDevice currentDevice] userInterfaceIdiom];
+
+ // If this device is an iPad, always return the "tall" height
+ if(interfaceIdiom == UIUserInterfaceIdiomPad)
+ {+ return kGNTextInputAccessoryViewHeightTall;
+ }
+ else
+ {+ return kGNTextInputAccessoryViewHeightShort;
+ }
+}
+
+-(void)cleanUp
+{+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+@end
--- iOS/Genesis/Genesis/GNTextInputAccessoryViewButton.h 69d3e39a2149f96bdc19a21258dfe72e06156941
+++ iOS/Genesis/Genesis/GNTextInputAccessoryViewButton.h db6cac2d4c75c984244c49a223cc03c0f11d0731
@@ -1,0 +1,22 @@
+/* Copyright (c) 2012, individual contributors
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#import <UIKit/UIKit.h>
+
+#define kGNTextInputAccessoryViewButtonWidth 30.0
+
+@interface GNTextInputAccessoryViewButton : UIButton
+
+@end
--- iOS/Genesis/Genesis/GNTextInputAccessoryViewButton.m 69d3e39a2149f96bdc19a21258dfe72e06156941
+++ iOS/Genesis/Genesis/GNTextInputAccessoryViewButton.m db6cac2d4c75c984244c49a223cc03c0f11d0731
@@ -1,0 +1,40 @@
+/* Copyright (c) 2012, individual contributors
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#import "GNTextInputAccessoryViewButton.h"
+#import "GNTextInputAccessoryView.h"
+
+@implementation GNTextInputAccessoryViewButton
+
+-(id)init
+{+ self = [UIButton buttonWithType:UIButtonTypeCustom];
+ if(self)
+ {+ [self setFrame:CGRectMake(0,
+ 0,
+ kGNTextInputAccessoryViewButtonWidth,
+ kGNTextInputAccessoryViewHeightTall)];
+ }
+
+ return self;
+}
+
+-(void)drawRect:(CGRect)rect
+{+ // Draw a gradient to our layer...
+}
+
+@end
--- iOS/Genesis/Genesis/GNTextInputManagerView.h 69d3e39a2149f96bdc19a21258dfe72e06156941
+++ iOS/Genesis/Genesis/GNTextInputManagerView.h db6cac2d4c75c984244c49a223cc03c0f11d0731
@@ -16,6 +16,7 @@
+#import "GNTextInputAccessoryView.h"
@@ -31,6 +32,8 @@
+ GNTextInputAccessoryView* inputAccessoryView;
+
@@ -40,5 +43,6 @@
+@property(readwrite) UIView* inputAccessoryView;
--- iOS/Genesis/Genesis/GNTextInputManagerView.m 69d3e39a2149f96bdc19a21258dfe72e06156941
+++ iOS/Genesis/Genesis/GNTextInputManagerView.m db6cac2d4c75c984244c49a223cc03c0f11d0731
@@ -20,6 +20,7 @@
+@synthesize inputAccessoryView;
@@ -37,6 +38,10 @@
+
+ // Set our input accessory view
+ inputAccessoryView = [[GNTextInputAccessoryView alloc] initWithDelegate:nil];
+ [self setInputAccessoryView:inputAccessoryView];
@@ -131,6 +136,7 @@
+ [inputAccessoryView cleanUp];