Permalink
Browse files

Create form field example

  • Loading branch information...
brunow committed May 24, 2012
1 parent a85b48e commit c6fde083a3c2ac30cc9620666471a4e9921df24d

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,15 @@
+//
+// AppDelegate.h
+// FormFieldExample
+//
+// Created by Bruno Wernimont on 23/05/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+@end
@@ -0,0 +1,52 @@
+//
+// AppDelegate.m
+// FormFieldExample
+//
+// Created by Bruno Wernimont on 23/05/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "AppDelegate.h"
+
+#import "FormFieldExampleTableViewController.h"
+
+@implementation AppDelegate
+
+@synthesize window = _window;
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ self.window.rootViewController = [[FormFieldExampleTableViewController alloc] init];
+ [self.window makeKeyAndVisible];
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application
+{
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application
+{
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application
+{
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application
+{
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application
+{
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+}
+
+@end
@@ -0,0 +1,45 @@
+<?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>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>brunow.${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>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'FormFieldExample' target in the 'FormFieldExample' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_4_0
+#warning "This project uses features only available in iOS SDK 4.0 and later."
+#endif
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
@@ -0,0 +1,13 @@
+//
+// FormFieldExampleTableViewController.h
+// FormFieldExample
+//
+// Created by Bruno Wernimont on 23/05/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface FormFieldExampleTableViewController : UITableViewController
+
+@end
@@ -0,0 +1,85 @@
+//
+// FormFieldExampleTableViewController.m
+// FormFieldExample
+//
+// Created by Bruno Wernimont on 23/05/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "FormFieldExampleTableViewController.h"
+
+#import "BaseKitFormField.h"
+#import "BaseKitViewAdditions.h"
+
+@interface FormFieldExampleTableViewController ()
+
+@end
+
+@implementation FormFieldExampleTableViewController
+
+- (id)init {
+ self = [super initWithStyle:UITableViewStyleGrouped];
+ if (self) {
+ // Custom initialization
+ }
+ return self;
+}
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+}
+
+- (void)viewDidUnload {
+ [super viewDidUnload];
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+#pragma mark - Table view data source
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+ return 1;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ return 7;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ UITableViewCell *cell = nil;
+ NSUInteger row = indexPath.row;
+
+ if (0 == row) {
+ cell = [BKLabelField cellForTableView:self.tableView];
+ cell.detailTextLabel.text = @"detail";
+ } else if (1 == row) {
+ cell = [BKSwitchField cellForTableView:self.tableView];
+ } else if (2 == row) {
+ cell = [BKTextField cellForTableView:self.tableView];
+ [(BKTextField *)cell textField].text = @"change me";
+ } else if (3 == row) {
+ cell = [BKPasswordTextField cellForTableView:self.tableView];
+ [(BKPasswordTextField *)cell textField].text = @"password";
+ } else if (4 == row) {
+ cell = [BKSliderField cellForTableView:self.tableView];
+ [[(BKSliderField *)cell slider] setValue:10 animated:NO];
+ } else if (5 == row) {
+ cell = [BKFloatField cellForTableView:self.tableView];
+ cell.detailTextLabel.text = @"10.5";
+ } else if (6 == row) {
+ cell = [BKIntegerField cellForTableView:self.tableView];
+ cell.detailTextLabel.text = @"10";
+ }
+
+ if (nil == cell) {
+ cell = [BKLabelField cellForTableView:self.tableView];
+ }
+
+ cell.textLabel.text = NSStringFromClass([cell class]);
+
+ return cell;
+}
+
+@end
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
@@ -0,0 +1,18 @@
+//
+// main.m
+// FormFieldExample
+//
+// Created by Bruno Wernimont on 23/05/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#import "AppDelegate.h"
+
+int main(int argc, char *argv[])
+{
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}

0 comments on commit c6fde08

Please sign in to comment.