forked from nicklockwood/FXForms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
928d700
commit 642f119
Showing
24 changed files
with
962 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// AppDelegate.h | ||
// BasicExample | ||
// | ||
// Created by Nick Lockwood on 04/02/2014. | ||
// Copyright (c) 2014 Charcoal Design. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface AppDelegate : UIResponder <UIApplicationDelegate> | ||
|
||
@property (strong, nonatomic) UIWindow *window; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// AppDelegate.m | ||
// BasicExample | ||
// | ||
// Created by Nick Lockwood on 04/02/2014. | ||
// Copyright (c) 2014 Charcoal Design. All rights reserved. | ||
// | ||
|
||
#import "AppDelegate.h" | ||
#import "LoginFormViewController.h" | ||
|
||
|
||
@implementation AppDelegate | ||
|
||
- (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWithOptions:(__unused NSDictionary *)launchOptions | ||
{ | ||
//set up window | ||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | ||
self.window.backgroundColor = [UIColor whiteColor]; | ||
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[LoginFormViewController alloc] init]]; | ||
[self.window makeKeyAndVisible]; | ||
return YES; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// CustomButtonCell.h | ||
// CustomButtonExample | ||
// | ||
// Created by Nick Lockwood on 07/04/2014. | ||
// Copyright (c) 2014 Charcoal Design. All rights reserved. | ||
// | ||
|
||
#import "FXForms.h" | ||
|
||
@interface CustomButtonCell : FXFormBaseCell | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// CustomButtonCell.m | ||
// CustomButtonExample | ||
// | ||
// Created by Nick Lockwood on 07/04/2014. | ||
// Copyright (c) 2014 Charcoal Design. All rights reserved. | ||
// | ||
|
||
#import "CustomButtonCell.h" | ||
|
||
|
||
@interface CustomButtonCell () | ||
|
||
@property (nonatomic, strong) IBOutlet UIButton *cellButton; | ||
|
||
@end | ||
|
||
|
||
@implementation CustomButtonCell | ||
|
||
//note: we could override -awakeFromNib or -initWithCoder: if we wanted | ||
//to do any customisation in code, but in this case we don't need to | ||
|
||
//if we were creating the cell programamtically instead of using a nib | ||
//we would override -initWithStyle:reuseIdentifier: to do the configuration | ||
|
||
- (IBAction)buttonAction | ||
{ | ||
if (self.field.action) self.field.action(self); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5053" systemVersion="13C64" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none"> | ||
<dependencies> | ||
<deployment defaultVersion="1280" identifier="iOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/> | ||
</dependencies> | ||
<objects> | ||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | ||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="MPJ-MW-Lvu" customClass="CustomButtonCell"> | ||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | ||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="MPJ-MW-Lvu" id="uvY-Ih-8JN"> | ||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<subviews> | ||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="WeG-za-goq"> | ||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<color key="backgroundColor" red="0.3921568627" green="0.7843137255" blue="0.3921568627" alpha="1" colorSpace="calibratedRGB"/> | ||
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/> | ||
<color key="tintColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/> | ||
<state key="normal" title="Submit"> | ||
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | ||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> | ||
</state> | ||
<state key="highlighted"> | ||
<color key="titleColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> | ||
</state> | ||
<connections> | ||
<action selector="buttonAction" destination="MPJ-MW-Lvu" eventType="touchUpInside" id="6jh-m7-t7e"/> | ||
</connections> | ||
</button> | ||
</subviews> | ||
</tableViewCellContentView> | ||
<connections> | ||
<outlet property="cellButton" destination="WeG-za-goq" id="nLd-Xt-K19"/> | ||
</connections> | ||
</tableViewCell> | ||
</objects> | ||
</document> |
38 changes: 38 additions & 0 deletions
38
Examples/CustomButtonExample/Classes/CustomButtonExample-Info.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?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>com.charcoaldesign.${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> | ||
</dict> | ||
</plist> |
16 changes: 16 additions & 0 deletions
16
Examples/CustomButtonExample/Classes/CustomButtonExample-Prefix.pch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// Prefix header | ||
// | ||
// The contents of this file are implicitly included at the beginning of every source file. | ||
// | ||
|
||
#import <Availability.h> | ||
|
||
#ifndef __IPHONE_3_0 | ||
#warning "This project uses features only available in iOS SDK 3.0 and later." | ||
#endif | ||
|
||
#ifdef __OBJC__ | ||
#import <UIKit/UIKit.h> | ||
#import <Foundation/Foundation.h> | ||
#endif |
23 changes: 23 additions & 0 deletions
23
Examples/CustomButtonExample/Classes/Images.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "29x29", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "40x40", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "60x60", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Examples/CustomButtonExample/Classes/Images.xcassets/LaunchImage.launchimage/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"orientation" : "portrait", | ||
"idiom" : "iphone", | ||
"extent" : "full-screen", | ||
"minimum-system-version" : "7.0", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"orientation" : "portrait", | ||
"idiom" : "iphone", | ||
"subtype" : "retina4", | ||
"extent" : "full-screen", | ||
"minimum-system-version" : "7.0", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// LoginForm.h | ||
// BasicExample | ||
// | ||
// Created by Nick Lockwood on 05/02/2014. | ||
// Copyright (c) 2014 Charcoal Design. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "FXForms.h" | ||
|
||
|
||
@interface LoginForm : NSObject <FXForm> | ||
|
||
@property (nonatomic, copy) NSString *email; | ||
@property (nonatomic, copy) NSString *password; | ||
@property (nonatomic, assign) BOOL rememberMe; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// LoginForm.m | ||
// BasicExample | ||
// | ||
// Created by Nick Lockwood on 05/02/2014. | ||
// Copyright (c) 2014 Charcoal Design. All rights reserved. | ||
// | ||
|
||
#import "LoginForm.h" | ||
#import "CustomButtonCell.h" | ||
|
||
|
||
@implementation LoginForm | ||
|
||
- (NSArray *)extraFields | ||
{ | ||
return @[ | ||
|
||
//we declare our custom submit buytton cell as normal, but note that | ||
//we have specified that we want to use our CustomButtonCell class | ||
//instead of the default FXFormBaseCell | ||
|
||
@{FXFormFieldCell: [CustomButtonCell class], FXFormFieldHeader: @"", FXFormFieldAction: @"submitLoginForm"}, | ||
|
||
]; | ||
} | ||
|
||
@end |
16 changes: 16 additions & 0 deletions
16
Examples/CustomButtonExample/Classes/LoginFormViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// RootFormViewController.h | ||
// BasicExample | ||
// | ||
// Created by Nick Lockwood on 25/03/2014. | ||
// Copyright (c) 2014 Charcoal Design. All rights reserved. | ||
// | ||
|
||
#import "FXForms.h" | ||
|
||
@interface LoginFormViewController : UIViewController <FXFormControllerDelegate> | ||
|
||
@property (nonatomic, strong) IBOutlet UITableView *tableView; | ||
@property (nonatomic, strong) FXFormController *formController; | ||
|
||
@end |
45 changes: 45 additions & 0 deletions
45
Examples/CustomButtonExample/Classes/LoginFormViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// RootFormViewController.m | ||
// BasicExample | ||
// | ||
// Created by Nick Lockwood on 25/03/2014. | ||
// Copyright (c) 2014 Charcoal Design. All rights reserved. | ||
// | ||
|
||
#import "LoginFormViewController.h" | ||
#import "LoginForm.h" | ||
|
||
|
||
@implementation LoginFormViewController | ||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
|
||
//set up form and form controller | ||
self.formController = [[FXFormController alloc] init]; | ||
self.formController.tableView = self.tableView; | ||
self.formController.delegate = self; | ||
self.formController.form = [[LoginForm alloc] init]; | ||
} | ||
|
||
- (void)viewWillAppear:(BOOL)animated | ||
{ | ||
[super viewWillAppear:animated]; | ||
|
||
//reload the table | ||
[self.tableView reloadData]; | ||
} | ||
|
||
|
||
//this is the action method for our submit button | ||
//the methods escalate through the responder chain until | ||
//they reach the AppDelegate | ||
|
||
- (void)submitLoginForm | ||
{ | ||
//now we can display a form value in our alert | ||
[[[UIAlertView alloc] initWithTitle:@"Login Form Submitted" message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil] show]; | ||
} | ||
|
||
@end |
30 changes: 30 additions & 0 deletions
30
Examples/CustomButtonExample/Classes/LoginFormViewController.xib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5053" systemVersion="13C64" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none"> | ||
<dependencies> | ||
<deployment defaultVersion="1280" identifier="iOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/> | ||
</dependencies> | ||
<objects> | ||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="LoginFormViewController"> | ||
<connections> | ||
<outlet property="tableView" destination="uAa-wO-xUa" id="sz2-Ta-QLl"/> | ||
<outlet property="view" destination="uAa-wO-xUa" id="5gq-pU-T6O"/> | ||
</connections> | ||
</placeholder> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | ||
<view contentMode="scaleToFill" id="iN0-l3-epB"> | ||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<subviews> | ||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="uAa-wO-xUa"> | ||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> | ||
</tableView> | ||
</subviews> | ||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> | ||
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/> | ||
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/> | ||
</view> | ||
</objects> | ||
</document> |
2 changes: 2 additions & 0 deletions
2
Examples/CustomButtonExample/Classes/en.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/* Localized versions of Info.plist keys */ | ||
|
Oops, something went wrong.