1 Commits

Author SHA1 Message Date
Mathias Claassen 825c6c3467 Add Header and Footer section to Readme FAQ 2017-04-05 09:46:25 -03:00
11 changed files with 14 additions and 83 deletions
@@ -57,7 +57,6 @@ NSString *const kCountDownTimer = @"countDownTimer";
// Date
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDateInline rowType:XLFormRowDescriptorTypeDateInline title:@"Date"];
row.value = [NSDate new];
[row.cellConfigAtConfigure setObject:[NSLocale localeWithLocaleIdentifier:@"FR_fr" ] forKey:@"locale"];
[section addFormRow:row];
// Time
@@ -76,7 +76,6 @@ class DatesFormViewController: XLFormViewController {
// Date
row = XLFormRowDescriptor(tag: Tags.DateInline, rowType: XLFormRowDescriptorTypeDateInline, title:"Date")
row.value = Date()
row.cellConfigAtConfigure["locale"] = Locale(identifier: "FR_fr")
section.addFormRow(row)
// Time
+1 -1
View File
@@ -6,7 +6,7 @@ By [XMARTLABS](http://xmartlabs.com).
[![Build Status](https://travis-ci.org/xmartlabs/XLForm.svg?branch=master)](https://travis-ci.org/xmartlabs/XLForm)
<a href="https://cocoapods.org/pods/XLForm"><img src="https://img.shields.io/cocoapods/v/XLForm.svg" alt="CocoaPods compatible" /></a>
**If you are working in Swift then you should have a look at [Eureka], a complete re-design of XLForm in Swift.** *Do not panic, we will continue maintaining and improving XLForm, obj-c rocks!!*
**If you are looking for Swift native implementation we have recently created [Eureka], a complete re-design of XLForm in Swift.** *Do not panic, We will continue maintaining and improving XLForm, obj-c rocks!!*
Purpose
--------------
+3 -16
View File
@@ -37,7 +37,6 @@
@implementation XLFormDateCell
{
UIColor * _beforeChangeColor;
NSDateFormatter *_dateFormatter;
}
@@ -110,7 +109,6 @@
{
[super configure];
self.formDatePickerMode = XLFormDateDatePickerModeGetFromRowDescriptor;
_dateFormatter = [[NSDateFormatter alloc] init];
}
-(void)update
@@ -175,14 +173,10 @@
}
}
if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeDate] || [self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeDateInline]){
_dateFormatter.dateStyle = NSDateFormatterMediumStyle;
_dateFormatter.timeStyle = NSDateFormatterNoStyle;
return [_dateFormatter stringFromDate:date];
return [NSDateFormatter localizedStringFromDate:date dateStyle:NSDateFormatterMediumStyle timeStyle:NSDateFormatterNoStyle];
}
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeTime] || [self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeTimeInline]){
_dateFormatter.dateStyle = NSDateFormatterNoStyle;
_dateFormatter.timeStyle = NSDateFormatterShortStyle;
return [_dateFormatter stringFromDate:date];
return [NSDateFormatter localizedStringFromDate:date dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle];
}
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeCountDownTimer] || [self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeCountDownTimerInline]){
NSCalendar *calendar = [NSCalendar currentCalendar];
@@ -190,9 +184,7 @@
NSDateComponents *time = [calendar components:NSCalendarUnitHour | NSCalendarUnitMinute fromDate:date];
return [NSString stringWithFormat:@"%ld%@ %ldmin", (long)[time hour], (long)[time hour] == 1 ? @"hour" : @"hours", (long)[time minute]];
}
_dateFormatter.dateStyle = NSDateFormatterShortStyle;
_dateFormatter.timeStyle = NSDateFormatterShortStyle;
return [_dateFormatter stringFromDate:date];
return [NSDateFormatter localizedStringFromDate:date dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle];
}
-(void)setModeToDatePicker:(UIDatePicker *)datePicker
@@ -236,11 +228,6 @@
return _datePicker;
}
-(void)setLocale:(NSLocale *)locale
{
_locale = locale;
_dateFormatter.locale = locale;
}
#pragma mark - Target Action
@@ -28,9 +28,6 @@
@interface XLFormOptionsObject : NSObject <XLFormOptionObject,NSCoding>
@property (nonatomic) NSString * formDisplaytext;
@property (nonatomic) id formValue;
+(XLFormOptionsObject *)formOptionsObjectWithValue:(id)value displayText:(NSString *)displayText;
+(XLFormOptionsObject *)formOptionsOptionForValue:(id)value fromOptions:(NSArray *)options;
+(XLFormOptionsObject *)formOptionsOptionForDisplayText:(NSString *)displayText fromOptions:(NSArray *)options;
+4 -3
View File
@@ -26,6 +26,10 @@
#import "XLFormOptionsObject.h"
@implementation XLFormOptionsObject
{
NSString * _formDisplaytext;
id _formValue;
}
+(XLFormOptionsObject *)formOptionsObjectWithValue:(id)value displayText:(NSString *)displayText
{
@@ -81,7 +85,6 @@
{
return _formValue;
}
#pragma mark - NSCoding
-(void)encodeWithCoder:(NSCoder *)encoder
{
@@ -91,7 +94,6 @@
[encoder encodeObject:self.formDisplayText
forKey:@"formDisplayText"];
}
-(instancetype)initWithCoder:(NSCoder *)decoder
{
if ((self=[super init])) {
@@ -106,5 +108,4 @@
return self;
}
@end
@@ -52,7 +52,6 @@ typedef NS_ENUM(NSUInteger, XLFormRowNavigationDirection) {
-(XLFormBaseCell *)updateFormRow:(XLFormRowDescriptor *)formRow;
-(NSDictionary *)formValues;
-(NSDictionary *)formValuesIncludingHidden;
-(NSDictionary *)httpParameters;
-(XLFormRowDescriptor *)formRowFormMultivaluedFormSection:(XLFormSectionDescriptor *)formSection;
@@ -61,7 +60,6 @@ typedef NS_ENUM(NSUInteger, XLFormRowNavigationDirection) {
-(NSArray *)formValidationErrors;
-(void)showFormValidationError:(NSError *)error;
-(void)showFormValidationError:(NSError *)error withTitle:(NSString*)title;
-(UITableViewRowAnimation)insertRowAnimationForRow:(XLFormRowDescriptor *)formRow;
-(UITableViewRowAnimation)deleteRowAnimationForRow:(XLFormRowDescriptor *)formRow;
@@ -346,11 +346,6 @@
return [self.form formValues];
}
-(NSDictionary *)formValuesIncludingHidden
{
return [self.form formValuesIncludingHidden];
}
-(NSDictionary *)httpParameters
{
return [self.form httpParameters:self];
@@ -497,38 +492,6 @@
#endif
}
-(void)showFormValidationError:(NSError *)error withTitle:(NSString*)title
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(title, nil)
message:error.localizedDescription
delegate:self
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[alertView show];
#else
if ([UIAlertController class]){
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(title, nil)
message:error.localizedDescription
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
}
#ifndef XL_APP_EXTENSIONS
else{
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(title, nil)
message:error.localizedDescription
delegate:self
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[alertView show];
}
#endif
#endif
}
-(void)performFormSelector:(SEL)selector withObject:(id)sender
{
UIResponder * responder = [self targetForAction:selector withSender:sender];;
-1
View File
@@ -82,7 +82,6 @@ typedef NS_OPTIONS(NSUInteger, XLFormRowNavigationOptions) {
-(nullable NSIndexPath *)indexPathOfFormRow:(nonnull XLFormRowDescriptor *)formRow;
-(nonnull NSDictionary *)formValues;
-(nonnull NSDictionary *)formValuesIncludingHidden;
-(nonnull NSDictionary *)httpParameters:(nonnull XLFormViewController *)formViewController;
-(nonnull NSArray *)localValidationErrors:(nonnull XLFormViewController *)formViewController;
+5 -17
View File
@@ -284,25 +284,13 @@ NSString * const XLValidationStatusErrorKey = @"XLValidationStatusErrorKey";
return nil;
}
-(NSDictionary *)formValuesIncludingHidden
{
return [self formValuesWithHidden:YES];
}
-(NSDictionary *)formValues
{
return [self formValuesWithHidden:NO];
}
-(NSDictionary *)formValuesWithHidden:(BOOL)includeHidden
{
NSArray* sections = includeHidden ? self.allSections : self.formSections;
NSMutableDictionary* result = [NSMutableDictionary dictionary];
for (XLFormSectionDescriptor * section in sections) {
NSArray* rows = includeHidden ? section.allRows : section.formRows;
NSMutableDictionary * result = [NSMutableDictionary dictionary];
for (XLFormSectionDescriptor * section in self.formSections) {
if (section.multivaluedTag.length > 0){
NSMutableArray* multiValuedValuesArray = [NSMutableArray new];
for (XLFormRowDescriptor * row in rows) {
NSMutableArray * multiValuedValuesArray = [NSMutableArray new];
for (XLFormRowDescriptor * row in section.formRows) {
if (row.value){
[multiValuedValuesArray addObject:row.value];
}
@@ -310,7 +298,7 @@ NSString * const XLValidationStatusErrorKey = @"XLValidationStatusErrorKey";
[result setObject:multiValuedValuesArray forKey:section.multivaluedTag];
}
else{
for (XLFormRowDescriptor * row in rows) {
for (XLFormRowDescriptor * row in section.formRows) {
if (row.tag.length > 0){
[result setObject:(row.value ?: [NSNull null]) forKey:row.tag];
}
@@ -69,6 +69,6 @@ typedef NS_ENUM(NSUInteger, XLFormSectionInsertMode) {
-(void)addFormRow:(nonnull XLFormRowDescriptor *)formRow beforeRow:(nonnull XLFormRowDescriptor *)beforeRow;
-(void)removeFormRowAtIndex:(NSUInteger)index;
-(void)removeFormRow:(nonnull XLFormRowDescriptor *)formRow;
-(void)moveRowAtIndexPath:(nonnull NSIndexPath *)sourceIndex toIndexPath:(nonnull NSIndexPath *)destinationIndex;
- (void)moveRowAtIndexPath:(NSIndexPath *)sourceIndex toIndexPath:(NSIndexPath *)destinationIndex;
@end