forked from xmartlabs/XLForm
-
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.
Merge branch 'master' into section_title_view
* master: (27 commits) Add property in XLFormTextViewCell to limit number of characters Add property in XLFormTextFieldCell to limit number of characters change XLFormUnspecifiedHeight constant to not collide with Automatic dimension datePicker.locale property public to developer,for example, _birthdayRow = [XLFormRowDescriptor formRowDescriptorWithTag:kBirthdayTag rowType:XLFormRowDescriptorTypeDateInline title:@"Birthday"]; [_birthdayRow.cellConfig setObject:[[NSLocale alloc] initWithLocaleIdentifier:@"en"] forKey:@"locale"]; Refactored '-(id)init' to '- (instancetype)init' Update 'initializeForm' example. Update pod badge [fixes xmartlabs#452] respect the currentLocale when parsing decimal values Remove the fix for suppressing "Empty snapshot" warnings when presenting action sheets Updated code to actually use the optionTitle variable Fixed selector action sheet to use the row's value transformer update pod version added count to empty check. Helpful to validate multiple selectors being empty Fix decimal number formatting. closes xmartlabs#514 Added height property to XLFormRowDescriptor updated readme with some comments. Fixes xmartlabs#771, fixes xmartlabs#727, fixes xmartlabs#696 Add support for NSFormatter Do validation can be nullable. fixes xmartlabs#705 fix crash when using cell style Value2. closes xmartlabs#770 Fix when the textFieldPercentage is applied. Closes xmartlabs#776 ...
- Loading branch information
Showing
39 changed files
with
861 additions
and
121 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
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
13 changes: 13 additions & 0 deletions
13
Examples/Objective-C/Examples/Formatters/FormattersViewController.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,13 @@ | ||
// | ||
// FormattersViewController.h | ||
// XLForm | ||
// | ||
// Created by Freddy Henin on 12/29/14. | ||
// Copyright (c) 2014 Xmartlabs. All rights reserved. | ||
// | ||
|
||
#import "XLFormViewController.h" | ||
|
||
@interface FormattersViewController : XLFormViewController | ||
|
||
@end |
115 changes: 115 additions & 0 deletions
115
Examples/Objective-C/Examples/Formatters/FormattersViewController.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,115 @@ | ||
// | ||
// FormattersViewController.m | ||
// XLForm | ||
// | ||
// Created by Freddy Henin on 12/29/14. | ||
// Copyright (c) 2014 Xmartlabs. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
|
||
#import "XLForm.h" | ||
|
||
#import "FormattersViewController.h" | ||
|
||
#import <SHSPhoneComponent/SHSPhoneNumberFormatter+UserConfig.h> | ||
|
||
|
||
// Simple little class to demonstraite currency formatting. Unfortunally we have to subclass | ||
// NSNumberFormatter to work aroundn some long known rounding bugs with NSNumberFormatter | ||
// http://stackoverflow.com/questions/12580162/nsstring-to-nsdate-conversion-issue | ||
@interface CurrencyFormatter : NSNumberFormatter | ||
|
||
@property (readonly) NSDecimalNumberHandler *roundingBehavior; | ||
|
||
@end | ||
|
||
@implementation CurrencyFormatter | ||
|
||
- (id) init | ||
{ | ||
self = [super init]; | ||
if (self) { | ||
[self setNumberStyle: NSNumberFormatterCurrencyStyle]; | ||
[self setGeneratesDecimalNumbers:YES]; | ||
|
||
NSUInteger currencyScale = [self maximumFractionDigits]; | ||
|
||
_roundingBehavior = [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundPlain scale:currencyScale raiseOnExactness:FALSE raiseOnOverflow:TRUE raiseOnUnderflow:TRUE raiseOnDivideByZero:TRUE]; | ||
|
||
} | ||
|
||
return self; | ||
} | ||
|
||
//- (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string errorDescription:(NSString **)error | ||
//{ | ||
// NSDecimalNumber *number; | ||
// BOOL success = [super getObjectValue:&number forString:string errorDescription:error]; | ||
// | ||
// if (success) { | ||
// *anObject = [number decimalNumberByRoundingAccordingToBehavior:_roundingBehavior]; | ||
// } | ||
// else { | ||
// *anObject = nil; | ||
// } | ||
// | ||
// return success; | ||
//} | ||
|
||
@end | ||
|
||
@interface FormattersViewController () | ||
@end | ||
|
||
@implementation FormattersViewController | ||
|
||
-(id)init | ||
{ | ||
XLFormDescriptor * formDescriptor = [XLFormDescriptor formDescriptorWithTitle:@"Text Fields"]; | ||
XLFormSectionDescriptor * section; | ||
XLFormRowDescriptor * row; | ||
|
||
formDescriptor.assignFirstResponderOnShow = NO; | ||
|
||
section = [XLFormSectionDescriptor formSection]; | ||
section.title = @"NSFormatter Support"; | ||
section.footerTitle = @"Rows can be configured to use the formatter as you type or to toggle on and off during for display/editing. You will most likely need custom NSFormatter objects to do on the fly formatting since NSNumberFormatter is pretty limited in this regard."; | ||
[formDescriptor addFormSection:section]; | ||
|
||
// Phone | ||
SHSPhoneNumberFormatter *formatter = [[SHSPhoneNumberFormatter alloc] init]; | ||
[formatter setDefaultOutputPattern:@"(###) ###-####" imagePath:nil]; | ||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"phone" rowType:XLFormRowDescriptorTypePhone title:@"US Phone"]; | ||
row.valueFormatter = formatter; | ||
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"]; | ||
|
||
row.useValueFormatterDuringInput = YES; | ||
[section addFormRow:row]; | ||
|
||
// Currency | ||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"currency" rowType:XLFormRowDescriptorTypeDecimal title:@"USD"]; | ||
CurrencyFormatter *numberFormatter = [[CurrencyFormatter alloc] init]; | ||
row.valueFormatter = numberFormatter; | ||
row.value = [NSDecimalNumber numberWithDouble:9.95]; | ||
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"]; | ||
[section addFormRow:row]; | ||
|
||
// Accounting | ||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"percent" rowType:XLFormRowDescriptorTypeNumber title:@"Test Score"]; | ||
NSNumberFormatter *acctFormatter = [[NSNumberFormatter alloc] init]; | ||
[acctFormatter setNumberStyle:NSNumberFormatterPercentStyle]; | ||
row.valueFormatter = acctFormatter; | ||
row.value = @(0.75); | ||
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"]; | ||
[section addFormRow:row]; | ||
|
||
section = [XLFormSectionDescriptor formSection]; | ||
[formDescriptor addFormSection:section]; | ||
|
||
return [super initWithForm:formDescriptor]; | ||
|
||
} | ||
|
||
@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
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,78 @@ | ||
PODS: | ||
- AFNetworking (2.6.3): | ||
- AFNetworking/NSURLConnection (= 2.6.3) | ||
- AFNetworking/NSURLSession (= 2.6.3) | ||
- AFNetworking/Reachability (= 2.6.3) | ||
- AFNetworking/Security (= 2.6.3) | ||
- AFNetworking/Serialization (= 2.6.3) | ||
- AFNetworking/UIKit (= 2.6.3) | ||
- AFNetworking/NSURLConnection (2.6.3): | ||
- AFNetworking/Reachability | ||
- AFNetworking/Security | ||
- AFNetworking/Serialization | ||
- AFNetworking/NSURLSession (2.6.3): | ||
- AFNetworking/Reachability | ||
- AFNetworking/Security | ||
- AFNetworking/Serialization | ||
- AFNetworking/Reachability (2.6.3) | ||
- AFNetworking/Security (2.6.3) | ||
- AFNetworking/Serialization (2.6.3) | ||
- AFNetworking/UIKit (2.6.3): | ||
- AFNetworking/NSURLConnection | ||
- AFNetworking/NSURLSession | ||
- AXRatingView (1.0.3) | ||
- JVFloatLabeledTextField (1.0.2) | ||
- SHSPhoneComponent (2.15) | ||
- XLData (2.0.0): | ||
- XLData/Core (= 2.0.0) | ||
- XLData/CoreData (= 2.0.0) | ||
- XLData/CoreRemote (= 2.0.0) | ||
- XLData/DataStore (= 2.0.0) | ||
- XLData/RemoteCoreData (= 2.0.0) | ||
- XLData/RemoteDataStore (= 2.0.0) | ||
- XLData/Core (2.0.0) | ||
- XLData/CoreData (2.0.0): | ||
- XLData/Core | ||
- XLData/CoreRemote (2.0.0): | ||
- AFNetworking (~> 2.0) | ||
- XLData/DataStore (2.0.0): | ||
- XLData/Core | ||
- XLData/RemoteCoreData (2.0.0): | ||
- XLData/CoreData | ||
- XLData/CoreRemote | ||
- XLData/RemoteDataStore (2.0.0): | ||
- XLData/CoreRemote | ||
- XLData/DataStore | ||
- XLForm (3.1.2) | ||
|
||
DEPENDENCIES: | ||
- AFNetworking (~> 2.0) | ||
- AXRatingView (= 1.0.3) | ||
- JVFloatLabeledTextField (= 1.0.2) | ||
- SHSPhoneComponent | ||
- XLData (from `https://github.com/xmartlabs/XLData.git`, commit `1f9019b56242a2019c7f7e11ec4ef823c397ebcf`) | ||
- XLForm (from `../../`) | ||
|
||
EXTERNAL SOURCES: | ||
XLData: | ||
:commit: 1f9019b56242a2019c7f7e11ec4ef823c397ebcf | ||
:git: https://github.com/xmartlabs/XLData.git | ||
XLForm: | ||
:path: ../../ | ||
|
||
CHECKOUT OPTIONS: | ||
XLData: | ||
:commit: 1f9019b56242a2019c7f7e11ec4ef823c397ebcf | ||
:git: https://github.com/xmartlabs/XLData.git | ||
|
||
SPEC CHECKSUMS: | ||
AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60 | ||
AXRatingView: ccaadc1bbda99a4b7e1d556059482d2b933a9f4e | ||
JVFloatLabeledTextField: 58a3a32cfb800e5b224f676987e7c13abf50a14d | ||
SHSPhoneComponent: 4cec0653a150ad63cbc52b0c8b29ce2d3c9c26f0 | ||
XLData: df725c6179e2e0c80bf56a1ecad9afd169707a6d | ||
XLForm: 6bb3c20857e2983cf494cb8b4d666c2a24673d5e | ||
|
||
PODFILE CHECKSUM: 80615792e859be64c95add3bb57c1596234faf95 | ||
|
||
COCOAPODS: 1.0.0 |
Oops, something went wrong.