Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8171cf11b5 |
@@ -21,4 +21,3 @@ DerivedData
|
||||
Pods
|
||||
Tests/Pods
|
||||
Tests/Podfile.lock
|
||||
Examples/Objective-C/Podfile.lock
|
||||
@@ -26,22 +26,16 @@
|
||||
#import "XLForm.h"
|
||||
#import "AccessoryViewFormViewController.h"
|
||||
|
||||
//This macro defines if we use predicates to hide rows or do it manually the old way.
|
||||
//Just comment out if you want it to run without predicates.
|
||||
#define USE_PREDICATES_FOR_HIDING
|
||||
|
||||
@interface AccessoryViewFormViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation AccessoryViewFormViewController
|
||||
{
|
||||
#ifndef USE_PREDICATES_FOR_HIDING
|
||||
XLFormRowDescriptor * _rowShowAccessoryView;
|
||||
XLFormRowDescriptor * _rowStopDisableRow;
|
||||
XLFormRowDescriptor * _rowStopInlineRow;
|
||||
XLFormRowDescriptor * _rowSkipCanNotBecomeFirstResponderRow;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +54,6 @@ NSString * kAccessoryViewCheck = @"check";
|
||||
NSString * kAccessoryViewNotes = @"notes";
|
||||
|
||||
|
||||
|
||||
|
||||
-(id)init
|
||||
{
|
||||
self = [super init];
|
||||
@@ -77,7 +69,7 @@ NSString * kAccessoryViewNotes = @"notes";
|
||||
formDescriptor.rowNavigationOptions = XLFormRowNavigationOptionEnabled;
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
XLFormRowDescriptor * switchRow;
|
||||
|
||||
|
||||
// Configuration section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Row Navigation Settings"];
|
||||
@@ -85,51 +77,29 @@ NSString * kAccessoryViewNotes = @"notes";
|
||||
[formDescriptor addFormSection:section];
|
||||
|
||||
// RowNavigationEnabled
|
||||
switchRow = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationEnabled rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Row Navigation Enabled?"];
|
||||
switchRow.value = @YES;
|
||||
[section addFormRow:switchRow];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationEnabled rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Row Navigation Enabled?"];
|
||||
row.value = @YES;
|
||||
[section addFormRow:row];
|
||||
|
||||
// RowNavigationShowAccessoryView
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationShowAccessoryView rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Show input accessory row?"];
|
||||
row.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionEnabled) == XLFormRowNavigationOptionEnabled);
|
||||
[section addFormRow:row];
|
||||
#ifdef USE_PREDICATES_FOR_HIDING
|
||||
row.hidden = [NSString stringWithFormat:@"$%@ == 0", switchRow];
|
||||
#else
|
||||
_rowShowAccessoryView = row;
|
||||
#endif
|
||||
_rowShowAccessoryView = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationShowAccessoryView rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Show input accessory view?"];
|
||||
_rowShowAccessoryView.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionEnabled) == XLFormRowNavigationOptionEnabled);
|
||||
[section addFormRow:_rowShowAccessoryView];
|
||||
|
||||
// RowNavigationStopDisableRow
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationStopDisableRow rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Stop when reach disabled row?"];
|
||||
row.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionStopDisableRow) == XLFormRowNavigationOptionStopDisableRow);
|
||||
[section addFormRow:row];
|
||||
#ifdef USE_PREDICATES_FOR_HIDING
|
||||
row.hidden = [NSString stringWithFormat:@"$%@ == 0", switchRow];
|
||||
#else
|
||||
_rowStopDisableRow = row;
|
||||
#endif
|
||||
_rowStopDisableRow = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationStopDisableRow rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Stop when reach disabled row?"];
|
||||
_rowStopDisableRow.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionStopDisableRow) == XLFormRowNavigationOptionStopDisableRow);
|
||||
[section addFormRow:_rowStopDisableRow];
|
||||
|
||||
// RowNavigationStopInlineRow
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationStopInlineRow rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Stop when reach inline row?"];
|
||||
row.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionStopInlineRow) == XLFormRowNavigationOptionStopInlineRow);
|
||||
[section addFormRow:row];
|
||||
#ifdef USE_PREDICATES_FOR_HIDING
|
||||
row.hidden = [NSString stringWithFormat:@"$%@ == 0", switchRow];
|
||||
#else
|
||||
_rowStopInlineRow = row;
|
||||
#endif
|
||||
_rowStopInlineRow = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationStopInlineRow rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Stop when reach inline row?"];
|
||||
_rowStopInlineRow.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionStopInlineRow) == XLFormRowNavigationOptionStopInlineRow);
|
||||
[section addFormRow:_rowStopInlineRow];
|
||||
|
||||
// RowNavigationSkipCanNotBecomeFirstResponderRow
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Skip Can Not Become First Responder Row?"];
|
||||
row.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow) == XLFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow);
|
||||
[section addFormRow:row];
|
||||
#ifdef USE_PREDICATES_FOR_HIDING
|
||||
row.hidden = [NSString stringWithFormat:@"$%@ == 0", switchRow];
|
||||
#else
|
||||
_rowSkipCanNotBecomeFirstResponderRow = row;
|
||||
#endif
|
||||
|
||||
|
||||
_rowSkipCanNotBecomeFirstResponderRow = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Skip Can Not Become First Responder Row?"];
|
||||
_rowSkipCanNotBecomeFirstResponderRow.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow) == XLFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow);
|
||||
[section addFormRow:_rowSkipCanNotBecomeFirstResponderRow];
|
||||
|
||||
// Basic Information - Section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"TextField Types"];
|
||||
@@ -149,7 +119,7 @@ NSString * kAccessoryViewNotes = @"notes";
|
||||
|
||||
// Twitter
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewTwitter rowType:XLFormRowDescriptorTypeTwitter title:@"Twitter"];
|
||||
row.disabled = @YES;
|
||||
row.disabled = YES;
|
||||
row.value = @"@no_editable";
|
||||
[section addFormRow:row];
|
||||
|
||||
@@ -188,7 +158,6 @@ NSString * kAccessoryViewNotes = @"notes";
|
||||
-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
|
||||
{
|
||||
[super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
|
||||
#ifndef USE_PREDICATES_FOR_HIDING
|
||||
NSString * kRowNavigationEnabled = @"kRowNavigationEnabled";
|
||||
if ([rowDescriptor.tag isEqualToString:kRowNavigationEnabled]){
|
||||
if ([[rowDescriptor.value valueData] isEqual:@NO]){
|
||||
@@ -211,9 +180,7 @@ NSString * kAccessoryViewNotes = @"notes";
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ([rowDescriptor.tag isEqualToString:kAccessoryViewRowNavigationStopDisableRow]){
|
||||
else if ([rowDescriptor.tag isEqualToString:kAccessoryViewRowNavigationStopDisableRow]){
|
||||
if ([[rowDescriptor.value valueData] isEqual:@(YES)]){
|
||||
self.form.rowNavigationOptions = self.form.rowNavigationOptions | XLFormRowNavigationOptionStopDisableRow;
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
// AppDelegate.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// AppDelegate.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// CustomRowsViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// CustomRowsViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -27,13 +27,11 @@
|
||||
#import "XLFormWeekDaysCell.h"
|
||||
#import "XLFormRatingCell.h"
|
||||
#import "FloatLabeledTextFieldCell.h"
|
||||
#import "XLFormCustomCell.h"
|
||||
|
||||
static NSString * const kCustomRowFirstRatingTag = @"CustomRowFirstRatingTag";
|
||||
static NSString * const kCustomRowSecondRatingTag = @"CustomRowSecondRatingTag";
|
||||
static NSString * const kCustomRowFloatLabeledTextFieldTag = @"CustomRowFloatLabeledTextFieldTag";
|
||||
static NSString * const kCustomRowWeekdays = @"CustomRowWeekdays";
|
||||
static NSString * const kCustomRowText = @"kCustomText";
|
||||
|
||||
@implementation CustomRowsViewController
|
||||
|
||||
@@ -71,12 +69,6 @@ static NSString * const kCustomRowText = @"kCustomText";
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomRowFloatLabeledTextFieldTag rowType:XLFormRowDescriptorTypeFloatLabeledTextField title:@"Title"];
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomRowFloatLabeledTextFieldTag rowType:XLFormRowDescriptorTypeFloatLabeledTextField title:@"First Name"];
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomRowFloatLabeledTextFieldTag rowType:XLFormRowDescriptorTypeFloatLabeledTextField title:@"Last Name"];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Section Weekdays
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Weekdays"];
|
||||
[form addFormSection:section];
|
||||
@@ -94,15 +86,6 @@ static NSString * const kCustomRowText = @"kCustomText";
|
||||
};
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[form addFormSection:section];
|
||||
|
||||
XLFormRowDescriptor *customRowDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomRowText rowType:@"XLFormRowDescriptorTypeCustom"];
|
||||
// Must set custom cell or add custom cell to cellClassesForRowDescriptorTypes dictionary before XLFormViewController loaded
|
||||
customRowDescriptor.cellClass = [XLFormCustomCell class];
|
||||
[section addFormRow:customRowDescriptor];
|
||||
|
||||
self.form = form;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// FloatLabeledTextFieldCell.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// FloatLabeledTextFieldCell.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -77,19 +77,13 @@ const static CGFloat kFloatingLabelFontSize = 11.0f;
|
||||
|
||||
self.floatLabeledTextField.attributedPlaceholder =
|
||||
[[NSAttributedString alloc] initWithString:self.rowDescriptor.title
|
||||
attributes:@{NSForegroundColorAttributeName: [UIColor lightGrayColor]}];
|
||||
attributes:@{NSForegroundColorAttributeName: [UIColor darkGrayColor]}];
|
||||
|
||||
self.floatLabeledTextField.text = self.rowDescriptor.value ? [self.rowDescriptor.value displayText] : self.rowDescriptor.noValueDisplayText;
|
||||
[self.floatLabeledTextField setEnabled:!self.rowDescriptor.disabled];
|
||||
|
||||
self.floatLabeledTextField.textColor = self.rowDescriptor.disabled ? [UIColor grayColor] : [UIColor blackColor];
|
||||
self.floatLabeledTextField.floatingLabelTextColor = [UIColor lightGrayColor];
|
||||
|
||||
[self.floatLabeledTextField setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
|
||||
}
|
||||
|
||||
-(BOOL)formDescriptorCellCanBecomeFirstResponder
|
||||
{
|
||||
return (!self.rowDescriptor.disabled);
|
||||
}
|
||||
|
||||
-(BOOL)formDescriptorCellBecomeFirstResponder
|
||||
@@ -97,6 +91,12 @@ const static CGFloat kFloatingLabelFontSize = 11.0f;
|
||||
return [self.floatLabeledTextField becomeFirstResponder];
|
||||
}
|
||||
|
||||
-(BOOL)formDescriptorCellResignFirstResponder
|
||||
{
|
||||
return [self.floatLabeledTextField resignFirstResponder];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UITextFieldDelegate
|
||||
|
||||
- (BOOL)textFieldShouldClear:(UITextField *)textField
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// XLRatingView.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// XLRatingView.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// XLFormRatingCell.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// XLFormRatingCell.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -47,9 +47,6 @@ NSString * const XLFormRowDescriptorTypeRate = @"XLFormRowDescriptorTypeRate";
|
||||
|
||||
self.ratingView.value = [self.rowDescriptor.value floatValue];
|
||||
self.rateTitle.text = self.rowDescriptor.title;
|
||||
|
||||
[self.ratingView setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
|
||||
[self.rateTitle setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
|
||||
}
|
||||
|
||||
#pragma mark - Events
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// XLFormWeekDaysCell.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// XLFormWeekDaysCell.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -100,14 +100,6 @@ NSString *const kSaturday = @"saturday";
|
||||
self.thursdayButton.selected = [[value objectForKey:kThursday] boolValue];
|
||||
self.fridayButton.selected = [[value objectForKey:kFriday] boolValue];
|
||||
self.saturdayButton.selected = [[value objectForKey:kSaturday] boolValue];
|
||||
|
||||
[self.sundayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
|
||||
[self.mondayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
|
||||
[self.tuesdayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
|
||||
[self.wednesdayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
|
||||
[self.thursdayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
|
||||
[self.fridayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
|
||||
[self.saturdayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
|
||||
}
|
||||
|
||||
-(NSString *)getDayFormButton:(id)sender
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// DateAndTimeValueTransformer.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface DateValueTrasformer : NSValueTransformer
|
||||
@end
|
||||
|
||||
@interface DateTimeValueTrasformer : NSValueTransformer
|
||||
@end
|
||||
|
||||
@interface DateAndTimeValueTrasformer : NSValueTransformer
|
||||
@end
|
||||
@@ -1,89 +0,0 @@
|
||||
//
|
||||
// DateAndTimeValueTransformer.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import "DateAndTimeValueTrasformer.h"
|
||||
|
||||
|
||||
@implementation DateValueTrasformer
|
||||
|
||||
+ (Class)transformedValueClass
|
||||
{
|
||||
return [NSString class];
|
||||
}
|
||||
|
||||
+ (BOOL)allowsReverseTransformation
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (id)transformedValue:(id)value
|
||||
{
|
||||
if (!value) return nil;
|
||||
if ([value isKindOfClass:[NSDate class]]){
|
||||
NSDate * date = (NSDate *)value;
|
||||
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
|
||||
[dateFormatter setDateStyle:NSDateFormatterFullStyle];
|
||||
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
|
||||
return [dateFormatter stringFromDate:date];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation DateTimeValueTrasformer
|
||||
|
||||
+ (Class)transformedValueClass
|
||||
{
|
||||
return [NSString class];
|
||||
}
|
||||
|
||||
+ (BOOL)allowsReverseTransformation
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (id)transformedValue:(id)value
|
||||
{
|
||||
if (!value) return nil;
|
||||
if ([value isKindOfClass:[NSDate class]]){
|
||||
NSDate * date = (NSDate *)value;
|
||||
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
|
||||
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
|
||||
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
|
||||
return [dateFormatter stringFromDate:date];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation DateAndTimeValueTrasformer
|
||||
|
||||
@end
|
||||
@@ -2,7 +2,7 @@
|
||||
// DatesFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// DatesFormViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -26,16 +26,13 @@
|
||||
NSString *const kDateInline = @"dateInline";
|
||||
NSString *const kTimeInline = @"timeInline";
|
||||
NSString *const kDateTimeInline = @"dateTimeInline";
|
||||
NSString *const kCountDownTimerInline = @"countDownTimerInline";
|
||||
NSString *const kDatePicker = @"datePicker";
|
||||
|
||||
NSString *const kDate = @"date";
|
||||
NSString *const kTime = @"time";
|
||||
NSString *const kDateTime = @"dateTime";
|
||||
NSString *const kCountDownTimer = @"countDownTimer";
|
||||
|
||||
#import "DatesFormViewController.h"
|
||||
@interface DatesFormViewController() <XLFormDescriptorDelegate>
|
||||
@end
|
||||
|
||||
|
||||
@implementation DatesFormViewController
|
||||
|
||||
@@ -46,10 +43,9 @@ NSString *const kCountDownTimer = @"countDownTimer";
|
||||
if (self){
|
||||
XLFormDescriptor * form;
|
||||
XLFormSectionDescriptor * section;
|
||||
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Date & Time"];
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Dates"];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Inline Dates"];
|
||||
[form addFormSection:section];
|
||||
@@ -59,21 +55,16 @@ NSString *const kCountDownTimer = @"countDownTimer";
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Time
|
||||
// DateTime
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kTimeInline rowType:XLFormRowDescriptorTypeTimeInline title:@"Time"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
// DateTime
|
||||
// Time
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDateTimeInline rowType:XLFormRowDescriptorTypeDateTimeInline title:@"Date Time"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
// CountDownTimer
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCountDownTimerInline rowType:XLFormRowDescriptorTypeCountDownTimerInline title:@"Countdown Timer"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Dates"];
|
||||
[form addFormSection:section];
|
||||
@@ -85,80 +76,32 @@ NSString *const kCountDownTimer = @"countDownTimer";
|
||||
[row.cellConfigAtConfigure setObject:[NSDate dateWithTimeIntervalSinceNow:(60*60*24*3)] forKey:@"maximumDate"];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Time
|
||||
// DateTime
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kTime rowType:XLFormRowDescriptorTypeTime title:@"Time"];
|
||||
[row.cellConfigAtConfigure setObject:@(10) forKey:@"minuteInterval"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
// DateTime
|
||||
// Time
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDateTime rowType:XLFormRowDescriptorTypeDateTime title:@"Date Time"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
// CountDownTimer
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCountDownTimerInline rowType:XLFormRowDescriptorTypeCountDownTimer title:@"Countdown Timer"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Disabled Dates"];
|
||||
//section.footerTitle = @"DatesFormViewController.h";
|
||||
section.footerTitle = @"DatesFormViewController.h";
|
||||
[form addFormSection:section];
|
||||
|
||||
// Date
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDate rowType:XLFormRowDescriptorTypeDate title:@"Date"];
|
||||
row.disabled = @YES;
|
||||
row.disabled = YES;
|
||||
row.required = YES;
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
// DatePicker
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"DatePicker"];
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDatePicker rowType:XLFormRowDescriptorTypeDatePicker];
|
||||
[row.cellConfigAtConfigure setObject:@(UIDatePickerModeDate) forKey:@"datePicker.datePickerMode"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
self.form = form;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
-(void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
UIBarButtonItem * barButton = [[UIBarButtonItem alloc] initWithTitle:@"Disable" style:UIBarButtonItemStylePlain
|
||||
target:self
|
||||
action:@selector(disableEnable:)];
|
||||
barButton.possibleTitles = [NSSet setWithObjects:@"Disable", @"Enable", nil];
|
||||
self.navigationItem.rightBarButtonItem = barButton;
|
||||
}
|
||||
|
||||
-(void)disableEnable:(UIBarButtonItem *)button
|
||||
{
|
||||
self.form.disabled = !self.form.disabled;
|
||||
[button setTitle:(self.form.disabled ? @"Enable" : @"Disable")];
|
||||
[self.tableView endEditing:YES];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)formRow oldValue:(id)oldValue newValue:(id)newValue
|
||||
{
|
||||
if([formRow.tag isEqualToString:kDatePicker])
|
||||
{
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"DatePicker"
|
||||
message:@"Value Has changed!"
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"OK"
|
||||
otherButtonTitles:nil];
|
||||
|
||||
[message show];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ExamplesFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ExamplesFormViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -33,18 +33,12 @@
|
||||
#import "UICustomizationFormViewController.h"
|
||||
#import "CustomRowsViewController.h"
|
||||
#import "AccessoryViewFormViewController.h"
|
||||
#import "PredicateFormViewController.h"
|
||||
|
||||
NSString * const kTextFieldAndTextView = @"TextFieldAndTextView";
|
||||
NSString * const kSelectors = @"Selectors";
|
||||
NSString * const kOthes = @"Others";
|
||||
NSString * const kDates = @"Dates";
|
||||
NSString * const kPredicates = @"BasicPredicates";
|
||||
NSString * const kBlogExample = @"BlogPredicates";
|
||||
NSString * const kMultivalued = @"Multivalued";
|
||||
NSString * const kMultivaluedOnlyReorder = @"MultivaluedOnlyReorder";
|
||||
NSString * const kMultivaluedOnlyInsert = @"MultivaluedOnlyInsert";
|
||||
NSString * const kMultivaluedOnlyDelete = @"MultivaluedOnlyDelete";
|
||||
NSString * const kValidations= @"Validations";
|
||||
|
||||
@interface ExamplesFormViewController ()
|
||||
@@ -109,7 +103,7 @@ NSString * const kValidations= @"Validations";
|
||||
[section addFormRow:row];
|
||||
|
||||
// Dates
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDates rowType:XLFormRowDescriptorTypeButton title:@"Date & Time"];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDates rowType:XLFormRowDescriptorTypeButton title:@"Dates"];
|
||||
row.action.viewControllerClass = [DatesFormViewController class];
|
||||
[section addFormRow:row];
|
||||
|
||||
@@ -121,24 +115,11 @@ NSString * const kValidations= @"Validations";
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multivalued example"];
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivalued rowType:XLFormRowDescriptorTypeButton title:@"Multivalued Sections"];
|
||||
row.action.viewControllerClass = [MultivaluedFormViewController class];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivalued rowType:XLFormRowDescriptorTypeButton title:@"MultiValued Sections"];
|
||||
row.action.viewControllerClass = [MultiValuedFormViewController class];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivaluedOnlyReorder rowType:XLFormRowDescriptorTypeButton title:@"Multivalued Only Reorder"];
|
||||
row.action.viewControllerClass = [MultivaluedOnlyReorderViewController class];
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivaluedOnlyInsert rowType:XLFormRowDescriptorTypeButton title:@"Multivalued Only Insert"];
|
||||
row.action.viewControllerClass = [MultivaluedOnlyInserViewController class];
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivaluedOnlyDelete rowType:XLFormRowDescriptorTypeButton title:@"Multivalued Only Delete"];
|
||||
row.action.viewControllerClass = [MultivaluedOnlyDeleteViewController class];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"UI Customization"];
|
||||
[form addFormSection:section];
|
||||
|
||||
@@ -169,21 +150,6 @@ NSString * const kValidations= @"Validations";
|
||||
row.action.formSegueIdenfifier = @"ValidationExamplesFormViewControllerSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Using Predicates"];
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredicates rowType:XLFormRowDescriptorTypeButton title:@"Very basic predicates"];
|
||||
row.action.formSegueIdenfifier = @"BasicPredicateViewControllerSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredicates rowType:XLFormRowDescriptorTypeButton title:@"Blog Example Hide predicates"];
|
||||
row.action.formSegueIdenfifier = @"BlogExampleViewSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredicates rowType:XLFormRowDescriptorTypeButton title:@"Another example"];
|
||||
row.action.formSegueIdenfifier = @"PredicateFormViewControllerSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
self.form = form;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// InputsFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// InputsFormViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -68,7 +68,7 @@ NSString *const kNotes = @"notes";
|
||||
|
||||
// Twitter
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kTwitter rowType:XLFormRowDescriptorTypeTwitter title:@"Twitter"];
|
||||
row.disabled = @YES;
|
||||
row.disabled = YES;
|
||||
row.value = @"@no_editable";
|
||||
[section addFormRow:row];
|
||||
|
||||
@@ -110,6 +110,14 @@ NSString *const kNotes = @"notes";
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kNotes rowType:XLFormRowDescriptorTypeTextView title:@"Notes"];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Dynamic Text View"];
|
||||
[formDescriptor addFormSection:section];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kTextView rowType:XLFormRowDescriptorTypeDynamicTextView];
|
||||
[row.cellConfigAtConfigure setObject:@"DYNAMIC TEXT VIEW EXAMPLE" forKey:@"textView.placeholder"];
|
||||
[row.cellConfigAtConfigure setObject:@(50) forKey:@"defaultHeight"];
|
||||
[section addFormRow:row];
|
||||
|
||||
return [super initWithForm:formDescriptor];
|
||||
|
||||
}
|
||||
@@ -121,7 +129,7 @@ NSString *const kNotes = @"notes";
|
||||
}
|
||||
|
||||
|
||||
-(void)savePressed:(UIBarButtonItem * __unused)button
|
||||
-(IBAction)savePressed:(UIBarButtonItem * __unused)button
|
||||
{
|
||||
NSArray * validationErrors = [self formValidationErrors];
|
||||
if (validationErrors.count > 0){
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// MultiValuedFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -25,21 +25,6 @@
|
||||
|
||||
#import "XLFormViewController.h"
|
||||
|
||||
@interface MultivaluedFormViewController : XLFormViewController
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface MultivaluedOnlyReorderViewController : XLFormViewController
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface MultivaluedOnlyInserViewController : XLFormViewController
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface MultivaluedOnlyDeleteViewController : XLFormViewController
|
||||
@interface MultiValuedFormViewController : XLFormViewController
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// MultiValuedFormViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -28,7 +28,7 @@
|
||||
#import "MultiValuedFormViewController.h"
|
||||
|
||||
|
||||
@implementation MultivaluedFormViewController
|
||||
@implementation MultiValuedFormViewController
|
||||
|
||||
- (id)init
|
||||
{
|
||||
@@ -36,52 +36,60 @@
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Multivalued Examples"];
|
||||
NSArray * nameList = @[@"family", @"male", @"female", @"client"];
|
||||
|
||||
// Multivalued section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multivalued TextField"
|
||||
sectionOptions:XLFormSectionOptionCanReorder | XLFormSectionOptionCanInsert | XLFormSectionOptionCanDelete
|
||||
sectionInsertMode:XLFormSectionInsertModeButton];
|
||||
section.multivaluedAddButton.title = @"Add New Tag";
|
||||
section.footerTitle = @"XLFormSectionInsertModeButton sectionType adds a 'Add Item' (Add New Tag) button row as last cell.";
|
||||
// set up the row template
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeName];
|
||||
[[row cellConfig] setObject:@"Tag Name" forKey:@"textField.placeholder"];
|
||||
section.multivaluedRowTemplate = row;
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"MultiValued Examples"];
|
||||
|
||||
// MultivaluedSection section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"MultiValued TextField" multivaluedSection:YES];
|
||||
section.multiValuedTag = @"textFieldRow";
|
||||
[form addFormSection:section];
|
||||
|
||||
|
||||
// Another Multivalued section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multivalued ActionSheet Selector example"
|
||||
sectionOptions:XLFormSectionOptionCanInsert | XLFormSectionOptionCanDelete];
|
||||
section.footerTitle = @"XLFormSectionInsertModeLastRow sectionType adds a '+' icon inside last table view cell allowing us to add a new row.";
|
||||
[form addFormSection:section];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorActionSheet title:@"Tap to select.."];
|
||||
row.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3", @"Option 4", @"Option 5"];
|
||||
for (NSString * tag in nameList) {
|
||||
// add a row to the section, the row will be used to crete new rows.
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeText];
|
||||
[[row cellConfig] setObject:@"Add a new tag" forKey:@"textField.placeholder"];
|
||||
row.value = [tag copy];
|
||||
[section addFormRow:row];
|
||||
}
|
||||
// add a row to the section, the row will be used to crete new rows.
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeText];
|
||||
[[row cellConfig] setObject:@"Add a new tag" forKey:@"textField.placeholder"];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Another MultivaluedSection section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"MultiValued ActionSheet Selector example" multivaluedSection:YES];
|
||||
section.multiValuedTag = @"actionSheetSelector";
|
||||
[form addFormSection:section];
|
||||
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorActionSheet title:@"Tap to select.."];
|
||||
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Option 1"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Option 4"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(4) displayText:@"Option 5"]
|
||||
];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
|
||||
// Another one
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multivalued Push Selector example"
|
||||
sectionOptions:XLFormSectionOptionCanInsert | XLFormSectionOptionCanDelete | XLFormSectionOptionCanReorder
|
||||
sectionInsertMode:XLFormSectionInsertModeButton];
|
||||
section.footerTitle = @"MultivaluedFormViewController.h";
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"MultiValued Push Selector example" multivaluedSection:YES];
|
||||
section.footerTitle = @"MultiValuedFormViewController.h";
|
||||
section.multiValuedTag = @"multivaluedPushSelector";
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorPush title:@"Tap to select ;).."];
|
||||
row.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3"];
|
||||
section.multivaluedRowTemplate = [row copy];
|
||||
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Option 1"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"]
|
||||
];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
// Add Section Button
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[form addFormSection:section];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"AddSectionButton" rowType:XLFormRowDescriptorTypeButton title:@"Add Section"];
|
||||
row.action.formSelector = @selector(didTouchAddSectionButton:);
|
||||
[row.cellConfigAtConfigure setObject:[UIColor clearColor] forKey:@"backgroundColor"];
|
||||
[row.cellConfig setObject:[UIColor grayColor] forKey:@"textLabel.color"];
|
||||
[row.cellConfig setObject:[UIFont fontWithName:@"Helvetica" size:17] forKey:@"textLabel.font"];
|
||||
[section addFormRow:row];
|
||||
|
||||
return [super initWithForm:form];
|
||||
}
|
||||
@@ -97,30 +105,11 @@
|
||||
|
||||
-(void)addDidTouch:(UIBarButtonItem * __unused)sender
|
||||
{
|
||||
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Remove Last Section" otherButtonTitles:@"Add a section at the end", self.form.isDisabled ? @"Enable Form" : @"Disable Form", nil];
|
||||
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Remove Last Section" otherButtonTitles:@"Add a section at the end", nil];
|
||||
[actionSheet showInView:self.view];
|
||||
|
||||
}
|
||||
|
||||
-(void)didTouchAddSectionButton:(XLFormRowDescriptor *)sender
|
||||
{
|
||||
// Create a new section
|
||||
XLFormSectionDescriptor * newSection = [XLFormSectionDescriptor formSectionWithTitle:[NSString stringWithFormat:@"Section created at %@", [NSDateFormatter localizedStringFromDate:[NSDate new] dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle]]];
|
||||
newSection.multivaluedTag = [NSString stringWithFormat:@"multivaluedPushSelector_%@", @(self.form.formSections.count-1)];
|
||||
|
||||
// Add rows to the new section
|
||||
XLFormRowDescriptor * newRow = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorPush title:@"Language"];
|
||||
newRow.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3"];
|
||||
[newSection addFormRow:newRow];
|
||||
newRow = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorPush title:@"Level"];
|
||||
newRow.selectorOptions = @[@"Option A", @"Option B", @"Option C"];
|
||||
[newSection addFormRow:newRow];
|
||||
|
||||
// Add new section
|
||||
[self.form addFormSection:newSection beforeSection:sender.sectionDescriptor];
|
||||
[self deselectFormRow:sender];
|
||||
}
|
||||
|
||||
#pragma mark - UIActionSheetDelegate
|
||||
|
||||
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||
@@ -133,178 +122,15 @@
|
||||
}
|
||||
else if ([[actionSheet buttonTitleAtIndex:buttonIndex] isEqualToString:@"Add a section at the end"]){
|
||||
// add a new section
|
||||
XLFormSectionDescriptor * newSection = [XLFormSectionDescriptor formSectionWithTitle:[NSString stringWithFormat:@"Section created at %@", [NSDateFormatter localizedStringFromDate:[NSDate new] dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle]] sectionOptions:XLFormSectionOptionCanInsert | XLFormSectionOptionCanDelete];
|
||||
newSection.multivaluedTag = [NSString stringWithFormat:@"multivaluedPushSelector_%@", @(self.form.formSections.count)];
|
||||
XLFormSectionDescriptor * newSection = [XLFormSectionDescriptor formSectionWithTitle:[NSString stringWithFormat:@"Section created at %@", [NSDateFormatter localizedStringFromDate:[NSDate new] dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle]] multivaluedSection:YES];
|
||||
newSection.multiValuedTag = [NSString stringWithFormat:@"multivaluedPushSelector_%@", @(self.form.formSections.count)];
|
||||
XLFormRowDescriptor * newRow = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorPush title:@"Tap to select ;).."];
|
||||
newRow.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3"];
|
||||
newRow.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Option 1"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"]];
|
||||
[newSection addFormRow:newRow];
|
||||
[self.form addFormSection:newSection];
|
||||
}
|
||||
else {
|
||||
self.form.disabled = !self.form.disabled;
|
||||
[self.tableView endEditing:YES];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation MultivaluedOnlyReorderViewController
|
||||
|
||||
- (id)init
|
||||
{
|
||||
NSTimeInterval secondsPerDay = 24 * 60 * 60;
|
||||
NSArray * list = @[@"Today", @"Yesterday", @"Before Yesterday"];
|
||||
XLFormDescriptor * form;
|
||||
XLFormSectionDescriptor * section;
|
||||
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Only Reorder Examples"];
|
||||
|
||||
|
||||
// Multivalued Section with inline rows - section set up to support only reordering
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Reordering Inline Rows"
|
||||
sectionOptions:XLFormSectionOptionCanReorder];
|
||||
section.footerTitle = @"XLFormRowDescriptorTypeDateInline row type";
|
||||
[form addFormSection:section];
|
||||
|
||||
[list enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeDateInline];
|
||||
row.value = [NSDate dateWithTimeIntervalSinceNow:(-secondsPerDay * idx)];
|
||||
row.title = obj;
|
||||
[section addFormRow:row];
|
||||
}];
|
||||
|
||||
|
||||
// Multivalued Section with common rows - section set up to support only reordering
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Reordering Rows"
|
||||
sectionOptions:XLFormSectionOptionCanReorder];
|
||||
section.footerTitle = @"XLFormRowDescriptorTypeInfo row type";
|
||||
[form addFormSection:section];
|
||||
|
||||
|
||||
[list enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeInfo];
|
||||
row.value = [NSDateFormatter localizedStringFromDate:[NSDate dateWithTimeIntervalSinceNow:(-secondsPerDay * idx)] dateStyle:NSDateFormatterMediumStyle timeStyle:NSDateFormatterNoStyle];
|
||||
row.title = obj;
|
||||
[section addFormRow:row];
|
||||
}];
|
||||
|
||||
return [super initWithForm:form];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation MultivaluedOnlyInserViewController
|
||||
|
||||
- (id)init
|
||||
{
|
||||
XLFormDescriptor * form;
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
NSArray * nameList = @[@"family", @"male", @"female", @"client"];
|
||||
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Multivalued Only Insert"];
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"XLFormSectionInsertModeButton"
|
||||
sectionOptions:XLFormSectionOptionCanInsert
|
||||
sectionInsertMode:XLFormSectionInsertModeButton];
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeText];
|
||||
[[row cellConfig] setObject:@"Add a new tag" forKey:@"textField.placeholder"];
|
||||
section.multivaluedRowTemplate = row;
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"XLFormSectionInsertModeButton With Inline Cells"
|
||||
sectionOptions:XLFormSectionOptionCanInsert
|
||||
sectionInsertMode:XLFormSectionInsertModeButton];
|
||||
[form addFormSection:section];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeDateInline];
|
||||
row.value = [NSDate new];
|
||||
row.title = @"Date";
|
||||
section.multivaluedRowTemplate = row;
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"XLFormSectionInsertModeLastRow"
|
||||
sectionOptions:XLFormSectionOptionCanInsert
|
||||
sectionInsertMode:XLFormSectionInsertModeLastRow];
|
||||
[form addFormSection:section];
|
||||
for (NSString * tag in nameList) {
|
||||
// add a row to the section, the row will be used to crete new rows.
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeText];
|
||||
[[row cellConfig] setObject:@"Add a new tag" forKey:@"textField.placeholder"];
|
||||
row.value = tag;
|
||||
[section addFormRow:row];
|
||||
}
|
||||
|
||||
return [super initWithForm:form];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation MultivaluedOnlyDeleteViewController
|
||||
|
||||
- (id)init
|
||||
{
|
||||
XLFormDescriptor * form;
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
NSArray * nameList = @[@"family", @"male", @"female", @"client"];
|
||||
|
||||
|
||||
form = [XLFormDescriptor formDescriptor];
|
||||
|
||||
// MultivaluedSection section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@""
|
||||
sectionOptions:XLFormSectionOptionCanDelete];
|
||||
section.footerTitle = @"you can swipe to delete when table.editing = NO (Not Editing)";
|
||||
[form addFormSection:section];
|
||||
|
||||
for (NSString * tag in nameList) {
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeText];
|
||||
[[row cellConfig] setObject:@"Add a new tag" forKey:@"textField.placeholder"];
|
||||
row.value = [tag copy];
|
||||
[section addFormRow:row];
|
||||
}
|
||||
|
||||
// Multivalued Section with inline row.
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@""
|
||||
sectionOptions:XLFormSectionOptionCanDelete];
|
||||
section.footerTitle = @"you can swipe to delete when table.editing = NO (Not Editing)";
|
||||
[form addFormSection:section];
|
||||
for (NSUInteger i = 0; i < 4; i++) {
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorPickerViewInline];
|
||||
row.title = @"Tap to select";
|
||||
row.value = @"client";
|
||||
row.selectorOptions = nameList;
|
||||
[section addFormRow:row];
|
||||
}
|
||||
|
||||
return [super initWithForm:form];
|
||||
}
|
||||
|
||||
|
||||
-(void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Editing" style:UIBarButtonItemStylePlain target:self action:@selector(toggleEditing:)];
|
||||
}
|
||||
|
||||
|
||||
-(void)toggleEditing:(UIBarButtonItem *)barButtonItem
|
||||
{
|
||||
[self.tableView setEditing:!self.tableView.editing animated:YES];
|
||||
[barButtonItem setTitle:(self.tableView.editing ? @"Editing" : @"Not Editing")];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 5.1 MiB After Width: | Height: | Size: 1.5 MiB |
@@ -2,7 +2,7 @@
|
||||
// XLFormCustomCell.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// XLFormCustomCell.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -30,20 +30,23 @@
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
// Initialization code
|
||||
// Initialization code
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)configure
|
||||
{
|
||||
[super configure];
|
||||
//override
|
||||
UIFont *labelFont = [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1];
|
||||
UIFontDescriptor *fontDesc = [labelFont fontDescriptor];
|
||||
UIFontDescriptor *fontBoldDesc = [fontDesc fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold];
|
||||
self.textLabel.font = [UIFont fontWithDescriptor:fontBoldDesc size:0.0f];
|
||||
}
|
||||
|
||||
- (void)update
|
||||
{
|
||||
[super update];
|
||||
// override
|
||||
self.textLabel.text = @"Am a custom cell, select me!";
|
||||
}
|
||||
@@ -52,9 +55,54 @@
|
||||
{
|
||||
// custom code here
|
||||
// i.e new behaviour when cell has been selected
|
||||
self.textLabel.text = [self.textLabel.text isEqualToString:@"I can do any custom behaviour..."] ? @"Am a custom cell, select me!" : @"I can do any custom behaviour...";
|
||||
self.textLabel.text = @"I can do any custom behaviour...";
|
||||
self.rowDescriptor.value = self.textLabel.text;
|
||||
[self.formViewController.tableView selectRowAtIndexPath:nil animated:YES scrollPosition:UITableViewScrollPositionNone];
|
||||
}
|
||||
|
||||
/*
|
||||
+(CGFloat)formDescriptorCellHeightForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor
|
||||
{
|
||||
// return custom cell size
|
||||
return 40;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
-(BOOL)formDescriptorCellBecomeFirstResponder
|
||||
{
|
||||
// custom code
|
||||
return YES;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
-(NSError *)formDescriptorCellLocalValidation
|
||||
{
|
||||
// custom error handler
|
||||
// compare with a custom property if it should return a error
|
||||
// i.e some textfield is empty etc...
|
||||
if (self.rowDescriptor.required){
|
||||
return [[NSError alloc] initWithDomain:XLFormErrorDomain code:XLFormErrorCodeRequired userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedString(@"%@ can't be empty", nil), self.rowDescriptor.title] }];
|
||||
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
-(NSString *)formDescriptorHttpParameterName
|
||||
{
|
||||
// custom code
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// Only override drawRect: if you perform custom drawing.
|
||||
// An empty implementation adversely affects performance during animation.
|
||||
- (void)drawRect:(CGRect)rect
|
||||
{
|
||||
// Drawing code
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// XLFormImageSelectorCell.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// XLFormImageSelectorCell.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -82,6 +82,7 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
|
||||
NSLog(@"Failed to download image");
|
||||
}];
|
||||
}
|
||||
[self.textLabel setFont:[UIFont preferredFontForTextStyle:UIFontTextStyleBody]];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// OthersFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// OthersFormViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#import "MapViewController.h"
|
||||
#import "OthersFormViewController.h"
|
||||
#import "XLFormCustomCell.h"
|
||||
|
||||
NSString *const kSwitchBool = @"switchBool";
|
||||
NSString *const kSwitchCheck = @"switchBool";
|
||||
@@ -96,7 +97,12 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
[row.cellConfigAtConfigure setObject:@(4) forKey:@"steps"];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
// Custom cell
|
||||
XLFormRowDescriptor *customRowDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:kCustom rowType:@"XLFormRowDescriptorTypeCustom"];
|
||||
// Must set custom cell or add custom cell to cellClassesForRowDescriptorTypes dictionary before XLFormViewController loaded
|
||||
customRowDescriptor.cellClass = [XLFormCustomCell class];
|
||||
[section addFormRow:customRowDescriptor];
|
||||
|
||||
// Info cell
|
||||
XLFormRowDescriptor *infoRowDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:kInfo rowType:XLFormRowDescriptorTypeInfo];
|
||||
infoRowDescriptor.title = @"Version";
|
||||
@@ -166,23 +172,4 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
[self deselectFormRow:sender];
|
||||
}
|
||||
|
||||
-(void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
UIBarButtonItem * barButton = [[UIBarButtonItem alloc] initWithTitle:@"Disable" style:UIBarButtonItemStylePlain
|
||||
target:self
|
||||
action:@selector(disableEnable:)];
|
||||
barButton.possibleTitles = [NSSet setWithObjects:@"Disable", @"Enable", nil];
|
||||
self.navigationItem.rightBarButtonItem = barButton;
|
||||
}
|
||||
|
||||
-(void)disableEnable:(UIBarButtonItem *)button
|
||||
{
|
||||
self.form.disabled = !self.form.disabled;
|
||||
[button setTitle:(self.form.disabled ? @"Enable" : @"Disable")];
|
||||
[self.tableView endEditing:YES];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
//
|
||||
// BasicPredicateViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import "XLForm.h"
|
||||
#import "XLFormViewController.h"
|
||||
|
||||
@interface BasicPredicateViewController : XLFormViewController
|
||||
|
||||
@end
|
||||
@@ -1,84 +0,0 @@
|
||||
//
|
||||
// BasicPredicateViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import "BasicPredicateViewController.h"
|
||||
|
||||
NSString *const khiderow = @"tag1";
|
||||
NSString *const khidesection = @"tag2";
|
||||
NSString *const ktext = @"tag3";
|
||||
|
||||
@implementation BasicPredicateViewController
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
if (self) {
|
||||
[self initializeForm];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self initializeForm];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)initializeForm
|
||||
{
|
||||
XLFormDescriptor * form;
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Basic Predicates"];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"A Section"];
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:khiderow rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Show next row"];
|
||||
row.value = @0;
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:khidesection rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Show B Section"];
|
||||
row.hidden = [NSString stringWithFormat:@"$%@==0", khiderow];
|
||||
row.value = @0;
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"B Section"];
|
||||
section.footerTitle = @"BasicPredicateViewController";
|
||||
section.hidden = [NSString stringWithFormat:@"$%@==0", khidesection];
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:ktext rowType:XLFormRowDescriptorTypeText title:@""];
|
||||
[row.cellConfigAtConfigure setObject:@"Gonna disappear soon!!" forKey:@"textField.placeholder"];
|
||||
[section addFormRow:row];
|
||||
|
||||
self.form = form;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,31 +0,0 @@
|
||||
//
|
||||
// BlogExampleViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import "XLForm.h"
|
||||
#import "XLFormViewController.h"
|
||||
|
||||
@interface BlogExampleViewController : XLFormViewController
|
||||
|
||||
@end
|
||||
@@ -1,109 +0,0 @@
|
||||
//
|
||||
// BlogExampleViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import "BlogExampleViewController.h"
|
||||
|
||||
NSString *const kHobbies = @"hobbies";
|
||||
NSString *const kSport = @"sport";
|
||||
NSString *const kFilm = @"films1";
|
||||
NSString *const kFilm2 = @"films2";
|
||||
NSString *const kMusic = @"music";
|
||||
|
||||
@interface BlogExampleViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation BlogExampleViewController
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
if (self) {
|
||||
[self initializeForm];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self initializeForm];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)initializeForm
|
||||
{
|
||||
XLFormDescriptor * form;
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Blog Example: Hobbies"];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Hobbies"];
|
||||
[form addFormSection:section];
|
||||
|
||||
XLFormRowDescriptor* hobbyRow = [XLFormRowDescriptor formRowDescriptorWithTag:kHobbies
|
||||
rowType:XLFormRowDescriptorTypeMultipleSelector
|
||||
title:@"Select Hobbies"];
|
||||
hobbyRow.selectorOptions = @[@"Sport", @"Music", @"Films"];
|
||||
hobbyRow.value = @[];
|
||||
[section addFormRow:hobbyRow];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Some more questions"];
|
||||
section.hidden = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"$%@.value.@count = 0", hobbyRow]];
|
||||
section.footerTitle = @"BlogExampleViewController.m";
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSport
|
||||
rowType:XLFormRowDescriptorTypeTextView
|
||||
title:@"Your favourite sportsman?"];
|
||||
row.hidden = [NSString stringWithFormat:@"NOT $%@.value contains 'Sport'", hobbyRow];
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kFilm
|
||||
rowType:XLFormRowDescriptorTypeTextView
|
||||
title:@"Your favourite film?"];
|
||||
row.hidden = [NSString stringWithFormat:@"NOT $%@ contains 'Films'", hobbyRow];
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kFilm2
|
||||
rowType:XLFormRowDescriptorTypeTextView
|
||||
title:@"Your favourite actor?"];
|
||||
row.hidden = [NSString stringWithFormat:@"NOT $%@ contains 'Films'", hobbyRow];
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMusic
|
||||
rowType:XLFormRowDescriptorTypeTextView
|
||||
title:@"Your favourite singer?"];
|
||||
row.hidden = [NSString stringWithFormat:@"NOT $%@ contains 'Music'", hobbyRow];
|
||||
[section addFormRow:row];
|
||||
|
||||
self.form = form;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -1,31 +0,0 @@
|
||||
//
|
||||
// PredicateFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import "XLForm.h"
|
||||
#import "XLFormViewController.h"
|
||||
|
||||
@interface PredicateFormViewController : XLFormViewController
|
||||
|
||||
@end
|
||||
@@ -1,113 +0,0 @@
|
||||
//
|
||||
// PredicateFormViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
NSString *const kPred = @"pred";
|
||||
NSString *const kPredDep = @"preddep";
|
||||
NSString *const kPredDep2 = @"preddep2";
|
||||
|
||||
#import "PredicateFormViewController.h"
|
||||
|
||||
@implementation PredicateFormViewController
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
if (self) {
|
||||
[self initializeForm];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self initializeForm];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)initializeForm
|
||||
{
|
||||
XLFormDescriptor * form;
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
XLFormRowDescriptor * pred, *pred3, *pred4;
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Predicates example"];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Independent rows"];
|
||||
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredDep rowType:XLFormRowDescriptorTypeAccount title:@"Text"];
|
||||
[row.cellConfigAtConfigure setObject:@"Type disable" forKey:@"textField.placeholder"];
|
||||
pred = row;
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredDep2 rowType:XLFormRowDescriptorTypeInteger title:@"Integer"];
|
||||
row.hidden = [NSString stringWithFormat:@"$switch==0"];
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"switch" rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Boolean"];
|
||||
row.value = @1;
|
||||
pred3 = row;
|
||||
[section addFormRow:row];
|
||||
|
||||
[form addFormSection:section];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Dependent section"];
|
||||
section.footerTitle = @"Type disable in the textfield, a number between 18 and 60 in the integer field or use the switch to disable the last row. By doing all three the last section will hide.\nThe integer field hides when the boolean switch is set to 0.";
|
||||
[form addFormSection:section];
|
||||
|
||||
// Predicate Disabling
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPred rowType:XLFormRowDescriptorTypeDateInline title:@"Disabled"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
row.disabled = [NSString stringWithFormat:@"$%@ contains[c] 'disable' OR ($%@.value between {18, 60}) OR ($%@.value == 0)", pred, kPredDep2, pred3];
|
||||
//[NSPredicate predicateWithFormat:[NSString stringWithFormat:@"($%@.value contains[c] %%@) OR ($%@.value between {18, 60}) OR ($%@.value == 0)", pred, pred2, pred3], @"disable"] ];
|
||||
pred4 = row;
|
||||
|
||||
section.hidden = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"($%@.value contains[c] 'disable') AND ($%@.value between {18, 60}) AND ($%@.value == 0)", pred, kPredDep2, pred3]];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"More predicates..."];
|
||||
section.footerTitle = @"This row hides when the row of the previous section is disabled and the textfield in the first section contains \"out\"\n\nPredicateFormViewController.m";
|
||||
[form addFormSection:section];
|
||||
|
||||
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"thirds" rowType:XLFormRowDescriptorTypeAccount title:@"Account"];
|
||||
[section addFormRow:row];
|
||||
row.hidden = [NSString stringWithFormat:@"$%@.isDisabled == 1 AND $%@.value contains[c] 'Out'", pred4, pred];
|
||||
|
||||
|
||||
|
||||
|
||||
self.form = form;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
Before Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 120 KiB |
@@ -2,7 +2,7 @@
|
||||
// NativeEventNavigationViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// NativeEventNavigationViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -24,10 +24,8 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import "XLForm.h"
|
||||
#import "DateAndTimeValueTrasformer.h"
|
||||
#import "NativeEventFormViewController.h"
|
||||
|
||||
|
||||
@implementation NativeEventNavigationViewController
|
||||
|
||||
-(id)init
|
||||
@@ -76,13 +74,13 @@
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Add Event"];
|
||||
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[form addFormSection:section];
|
||||
|
||||
// Title
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"Title" rowType:XLFormRowDescriptorTypeText];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"title" rowType:XLFormRowDescriptorTypeText];
|
||||
[row.cellConfigAtConfigure setObject:@"Title" forKey:@"textField.placeholder"];
|
||||
row.required = YES;
|
||||
[section addFormRow:row];
|
||||
|
||||
// Location
|
||||
@@ -190,7 +188,7 @@
|
||||
if ([[rowDescriptor.value valueData] isEqualToNumber:@(0)] == NO && [[oldValue valueData] isEqualToNumber:@(0)]){
|
||||
|
||||
XLFormRowDescriptor * newRow = [rowDescriptor copy];
|
||||
newRow.tag = @"secondAlert";
|
||||
[newRow setTag:@"secondAlert"];
|
||||
newRow.title = @"Second Alert";
|
||||
[self.form addFormRow:newRow afterRow:rowDescriptor];
|
||||
}
|
||||
@@ -199,22 +197,23 @@
|
||||
}
|
||||
}
|
||||
else if ([rowDescriptor.tag isEqualToString:@"all-day"]){
|
||||
XLFormRowDescriptor * startDateDescriptor = [self.form formRowWithTag:@"starts"];
|
||||
XLFormRowDescriptor * endDateDescriptor = [self.form formRowWithTag:@"ends"];
|
||||
XLFormDateCell * dateStartCell = (XLFormDateCell *)[[self.form formRowWithTag:@"starts"] cellForFormController:self];
|
||||
XLFormDateCell * dateEndCell = (XLFormDateCell *)[[self.form formRowWithTag:@"ends"] cellForFormController:self];
|
||||
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
|
||||
if ([[rowDescriptor.value valueData] boolValue] == YES){
|
||||
startDateDescriptor.valueTransformer = [DateValueTrasformer class];
|
||||
endDateDescriptor.valueTransformer = [DateValueTrasformer class];
|
||||
[dateFormatter setDateStyle:NSDateFormatterFullStyle];
|
||||
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
|
||||
[dateStartCell setFormDatePickerMode:XLFormDateDatePickerModeDate];
|
||||
[dateEndCell setFormDatePickerMode:XLFormDateDatePickerModeDate];
|
||||
}
|
||||
else{
|
||||
startDateDescriptor.valueTransformer = [DateTimeValueTrasformer class];
|
||||
endDateDescriptor.valueTransformer = [DateTimeValueTrasformer class];
|
||||
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
|
||||
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
|
||||
[dateStartCell setFormDatePickerMode:XLFormDateDatePickerModeDateTime];
|
||||
[dateEndCell setFormDatePickerMode:XLFormDateDatePickerModeDateTime];
|
||||
}
|
||||
dateStartCell.dateFormatter = dateFormatter;
|
||||
dateEndCell.dateFormatter = dateFormatter;
|
||||
[dateStartCell update];
|
||||
[dateEndCell update];
|
||||
}
|
||||
@@ -242,13 +241,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
-(void)cancelPressed:(UIBarButtonItem * __unused)button
|
||||
-(IBAction)cancelPressed:(UIBarButtonItem * __unused)button
|
||||
{
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
||||
-(void)savePressed:(UIBarButtonItem * __unused)button
|
||||
-(IBAction)savePressed:(UIBarButtonItem * __unused)button
|
||||
{
|
||||
NSArray * validationErrors = [self formValidationErrors];
|
||||
if (validationErrors.count > 0){
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// CustomSelectorsFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// CustomSelectorsFormViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// CLLocationValueTrasformer.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// CLLocationValueTrasformer.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// MapViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// MapViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// DynamicSelectorsFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// DynamicSelectorsFormViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// UsersTableViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// UsersTableViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// CoreDataStore.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// CoreDataStore.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// User+Additions.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// User+Additions.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// User.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// User.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// UserLocalDataLoader.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// UserLocalDataLoader.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// UserRemoteDataLoader.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// UserRemoteDataLoader.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// HTTPSessionManager.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// HTTPSessionManager.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SelectorsFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SelectorsFormViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -325,7 +325,7 @@ NSString *const kSelectorWithStoryboardId = @"selectorWithStoryboardId";
|
||||
// Disabled Selector Push
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorPushDisabled rowType:XLFormRowDescriptorTypeSelectorPush title:@"Push"];
|
||||
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"];
|
||||
row.disabled = @YES;
|
||||
row.disabled = YES;
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ NSString *const kSelectorWithStoryboardId = @"selectorWithStoryboardId";
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorActionSheetDisabled rowType:XLFormRowDescriptorTypeSelectorActionSheet title:@"Sheet"];
|
||||
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"];
|
||||
row.disabled = @YES;
|
||||
row.disabled = YES;
|
||||
[section addFormRow:row];
|
||||
|
||||
// --------- Disabled Selector Left Right
|
||||
@@ -342,7 +342,7 @@ NSString *const kSelectorWithStoryboardId = @"selectorWithStoryboardId";
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorLeftRightDisabled rowType:XLFormRowDescriptorTypeSelectorLeftRight title:@"Left Right"];
|
||||
row.leftRightSelectorLeftOptionSelected = [XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"];
|
||||
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Right Option 4"];
|
||||
row.disabled = @YES;
|
||||
row.disabled = YES;
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
@@ -392,24 +392,4 @@ NSString *const kSelectorWithStoryboardId = @"selectorWithStoryboardId";
|
||||
}
|
||||
|
||||
|
||||
-(void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
UIBarButtonItem * barButton = [[UIBarButtonItem alloc] initWithTitle:@"Disable" style:UIBarButtonItemStylePlain
|
||||
target:self
|
||||
action:@selector(disableEnable:)];
|
||||
barButton.possibleTitles = [NSSet setWithObjects:@"Disable", @"Enable", nil];
|
||||
self.navigationItem.rightBarButtonItem = barButton;
|
||||
}
|
||||
|
||||
-(void)disableEnable:(UIBarButtonItem *)button
|
||||
{
|
||||
self.form.disabled = !self.form.disabled;
|
||||
[button setTitle:(self.form.disabled ? @"Enable" : @"Disable")];
|
||||
[self.tableView endEditing:YES];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7531" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="p4n-1v-pzo">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="p4n-1v-pzo">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Navigation Controller-->
|
||||
@@ -111,34 +111,12 @@
|
||||
<segue destination="G68-Ra-1fb" kind="push" identifier="SelectorsFormViewControllerSegue" id="vhA-cV-A02"/>
|
||||
<segue destination="K9D-4c-9eZ" kind="modal" identifier="NativeEventNavigationViewControllerSegue" id="Iie-Js-Izx"/>
|
||||
<segue destination="Kiw-nF-jv7" kind="push" identifier="ValidationExamplesFormViewControllerSegue" id="VKe-Ir-Fiu"/>
|
||||
<segue destination="OG6-Tc-1SC" kind="push" identifier="PredicateFormViewControllerSegue" id="Wwg-e9-gLq"/>
|
||||
<segue destination="pO0-sS-Tes" kind="push" identifier="BlogExampleViewSegue" id="a28-Gm-Iku"/>
|
||||
<segue destination="JL7-uU-kWK" kind="push" identifier="BasicPredicateViewControllerSegue" id="SGg-Ve-bng"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="1V5-DZ-WfF" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="527" y="56"/>
|
||||
</scene>
|
||||
<!--Blog Example View Controller-->
|
||||
<scene sceneID="Vn0-9y-5bc">
|
||||
<objects>
|
||||
<viewController id="pO0-sS-Tes" customClass="BlogExampleViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="gjZ-Jv-Awa"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="scM-da-Sg0"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="hrV-fb-58s">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="RJB-cz-SnF"/>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Fvo-wr-5Ca" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="167" y="1151"/>
|
||||
</scene>
|
||||
<!--Validation Examples-->
|
||||
<scene sceneID="z2I-Nk-y9W">
|
||||
<objects>
|
||||
@@ -173,26 +151,7 @@
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="VFT-Og-STO" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="566" y="938"/>
|
||||
</scene>
|
||||
<!--Predicate Form View Controller-->
|
||||
<scene sceneID="a9p-C8-g8y">
|
||||
<objects>
|
||||
<viewController id="OG6-Tc-1SC" customClass="PredicateFormViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="2YH-dK-JXQ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="Lsg-dH-McH"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="6EZ-O7-FjX">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="Lsd-xH-7IN"/>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="rZL-10-YZn" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="956" y="924"/>
|
||||
<point key="canvasLocation" x="527" y="789"/>
|
||||
</scene>
|
||||
<!--Selectors Form View Controller-->
|
||||
<scene sceneID="KYK-TX-8rm">
|
||||
@@ -253,25 +212,6 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="588" y="-635"/>
|
||||
</scene>
|
||||
<!--Basic Predicate View Controller-->
|
||||
<scene sceneID="pD4-sm-x3a">
|
||||
<objects>
|
||||
<viewController id="JL7-uU-kWK" customClass="BasicPredicateViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="OQP-pW-kNp"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="2b4-gN-85p"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="NZg-t1-g19">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="1lh-jZ-lIV"/>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Tlw-q2-pcu" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-159" y="1151"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<simulatedStatusBarMetrics key="statusBar"/>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// UICustomizationFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// UICustomizationFormViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ValidationExamplesFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ValidationExamplesFormViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
PODS:
|
||||
- AFNetworking (2.4.1):
|
||||
- AFNetworking/NSURLConnection (= 2.4.1)
|
||||
- AFNetworking/NSURLSession (= 2.4.1)
|
||||
- AFNetworking/Reachability (= 2.4.1)
|
||||
- AFNetworking/Security (= 2.4.1)
|
||||
- AFNetworking/Serialization (= 2.4.1)
|
||||
- AFNetworking/UIKit (= 2.4.1)
|
||||
- AFNetworking/NSURLConnection (2.4.1):
|
||||
- AFNetworking/Reachability
|
||||
- AFNetworking/Security
|
||||
- AFNetworking/Serialization
|
||||
- AFNetworking/NSURLSession (2.4.1):
|
||||
- AFNetworking/Reachability
|
||||
- AFNetworking/Security
|
||||
- AFNetworking/Serialization
|
||||
- AFNetworking/Reachability (2.4.1)
|
||||
- AFNetworking/Security (2.4.1)
|
||||
- AFNetworking/Serialization (2.4.1)
|
||||
- AFNetworking/UIKit (2.4.1):
|
||||
- AFNetworking/NSURLConnection
|
||||
- AFNetworking/NSURLSession
|
||||
- AXRatingView (1.0.3)
|
||||
- JVFloatLabeledTextField (1.0.2)
|
||||
- XLDataLoader (1.1.0):
|
||||
- AFNetworking (~> 2.0)
|
||||
- XLForm (2.1.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- AFNetworking (~> 2.0)
|
||||
- AXRatingView (= 1.0.3)
|
||||
- JVFloatLabeledTextField (= 1.0.2)
|
||||
- XLDataLoader (~> 1.1)
|
||||
- XLForm (from `../../`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
XLForm:
|
||||
:path: ../../
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
AFNetworking: 0aabc6fae66d6e5d039eeb21c315843c7aae51ab
|
||||
AXRatingView: 4f6d6c96f6d0efc1deaa6cf493dbb1ffcfa79e55
|
||||
JVFloatLabeledTextField: c1ad6b4b5bd77115cfe6c71ba4c023866df5c4cf
|
||||
XLDataLoader: bd783ebe782932a6390ffc7619fcd884c8600944
|
||||
XLForm: c87bc94f769f52ce32793282d72d2fb15d0d5638
|
||||
|
||||
COCOAPODS: 0.35.0
|
||||
@@ -49,18 +49,14 @@
|
||||
3C3B01E21AB7499A0027CD45 /* XLRatingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3B01E01AB7499A0027CD45 /* XLRatingView.m */; };
|
||||
3C3B01F01AB74BDC0027CD45 /* FloatLabeledTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3B01EF1AB74BDC0027CD45 /* FloatLabeledTextFieldCell.m */; };
|
||||
3CDAFC7A1AB0AFA4000F75B6 /* CustomRowsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDAFC791AB0AFA4000F75B6 /* CustomRowsViewController.m */; };
|
||||
66B6266E1AE0055100007886 /* DateAndTimeValueTrasformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 66B6266D1AE0055100007886 /* DateAndTimeValueTrasformer.m */; };
|
||||
BF9DB1D51AE0436600B985E7 /* BlogExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF9DB1D21AE0436600B985E7 /* BlogExampleViewController.m */; };
|
||||
BF9DB1D61AE0436600B985E7 /* PredicateFormViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF9DB1D41AE0436600B985E7 /* PredicateFormViewController.m */; };
|
||||
BFE91AFB1AE159B200DE5231 /* BasicPredicateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BFE91AFA1AE159B200DE5231 /* BasicPredicateViewController.m */; };
|
||||
D51B8B2C19126664008C0478 /* XLFormCustomCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D51B8B2B19126664008C0478 /* XLFormCustomCell.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
281E5BE719538F4A006D93C5 /* CLLocationValueTrasformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CLLocationValueTrasformer.h; path = Examples/Selectors/CustomSelectors/XLFormRowViewController/CLLocationValueTrasformer.h; sourceTree = "<group>"; };
|
||||
281E5BE819538F4A006D93C5 /* CLLocationValueTrasformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CLLocationValueTrasformer.m; path = Examples/Selectors/CustomSelectors/XLFormRowViewController/CLLocationValueTrasformer.m; sourceTree = "<group>"; };
|
||||
282EB27A1AB5FF33004A736F /* AccessoryViewFormViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AccessoryViewFormViewController.h; path = Examples/AccessoryViews/AccessoryViewFormViewController.h; sourceTree = "<group>"; };
|
||||
282EB27B1AB5FF33004A736F /* AccessoryViewFormViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AccessoryViewFormViewController.m; path = Examples/AccessoryViews/AccessoryViewFormViewController.m; sourceTree = "<group>"; };
|
||||
282EB27A1AB5FF33004A736F /* AccessoryViewFormViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AccessoryViewFormViewController.h; path = AccessoryViews/AccessoryViewFormViewController.h; sourceTree = "<group>"; };
|
||||
282EB27B1AB5FF33004A736F /* AccessoryViewFormViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AccessoryViewFormViewController.m; path = AccessoryViews/AccessoryViewFormViewController.m; sourceTree = "<group>"; };
|
||||
283B59B019532415000828CD /* MapViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MapViewController.h; path = Examples/Selectors/CustomSelectors/XLFormRowViewController/MapViewController.h; sourceTree = "<group>"; };
|
||||
283B59B119532415000828CD /* MapViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MapViewController.m; path = Examples/Selectors/CustomSelectors/XLFormRowViewController/MapViewController.m; sourceTree = "<group>"; };
|
||||
283B59B5195334AF000828CD /* CustomSelectorsFormViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomSelectorsFormViewController.h; path = Examples/Selectors/CustomSelectors/CustomSelectorsFormViewController.h; sourceTree = "<group>"; };
|
||||
@@ -129,16 +125,8 @@
|
||||
3C3B01EF1AB74BDC0027CD45 /* FloatLabeledTextFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FloatLabeledTextFieldCell.m; path = Examples/CustomRows/FloatLabeledTextField/FloatLabeledTextFieldCell.m; sourceTree = "<group>"; };
|
||||
3CDAFC781AB0AFA4000F75B6 /* CustomRowsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomRowsViewController.h; path = Examples/CustomRows/CustomRowsViewController.h; sourceTree = "<group>"; };
|
||||
3CDAFC791AB0AFA4000F75B6 /* CustomRowsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CustomRowsViewController.m; path = Examples/CustomRows/CustomRowsViewController.m; sourceTree = "<group>"; };
|
||||
66B6266C1AE0055100007886 /* DateAndTimeValueTrasformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DateAndTimeValueTrasformer.h; path = Examples/Dates/DateAndTimeValueTrasformer.h; sourceTree = "<group>"; };
|
||||
66B6266D1AE0055100007886 /* DateAndTimeValueTrasformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DateAndTimeValueTrasformer.m; path = Examples/Dates/DateAndTimeValueTrasformer.m; sourceTree = "<group>"; };
|
||||
7B0D2D6A86E2A41ED22E8A35 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
976A33EE62A018A7257B4878 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
|
||||
BF9DB1D11AE0436600B985E7 /* BlogExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BlogExampleViewController.h; path = Examples/PredicateExamples/BlogExampleViewController.h; sourceTree = SOURCE_ROOT; };
|
||||
BF9DB1D21AE0436600B985E7 /* BlogExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BlogExampleViewController.m; path = Examples/PredicateExamples/BlogExampleViewController.m; sourceTree = SOURCE_ROOT; };
|
||||
BF9DB1D31AE0436600B985E7 /* PredicateFormViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PredicateFormViewController.h; path = Examples/PredicateExamples/PredicateFormViewController.h; sourceTree = SOURCE_ROOT; };
|
||||
BF9DB1D41AE0436600B985E7 /* PredicateFormViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PredicateFormViewController.m; path = Examples/PredicateExamples/PredicateFormViewController.m; sourceTree = SOURCE_ROOT; };
|
||||
BFE91AF91AE159B200DE5231 /* BasicPredicateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BasicPredicateViewController.h; path = Examples/PredicateExamples/BasicPredicateViewController.h; sourceTree = SOURCE_ROOT; };
|
||||
BFE91AFA1AE159B200DE5231 /* BasicPredicateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BasicPredicateViewController.m; path = Examples/PredicateExamples/BasicPredicateViewController.m; sourceTree = SOURCE_ROOT; };
|
||||
D51B8B2A19126664008C0478 /* XLFormCustomCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLFormCustomCell.h; path = Examples/Others/CustomCells/XLFormCustomCell.h; sourceTree = "<group>"; };
|
||||
D51B8B2B19126664008C0478 /* XLFormCustomCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLFormCustomCell.m; path = Examples/Others/CustomCells/XLFormCustomCell.m; sourceTree = "<group>"; };
|
||||
F6DF43B7BBF44F72A4493E8E /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -243,8 +231,6 @@
|
||||
2843EB5318D4F77F00F13E2B /* Dates */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
66B6266C1AE0055100007886 /* DateAndTimeValueTrasformer.h */,
|
||||
66B6266D1AE0055100007886 /* DateAndTimeValueTrasformer.m */,
|
||||
2843EB5418D4F7B700F13E2B /* DatesFormViewController.h */,
|
||||
2843EB5518D4F7B700F13E2B /* DatesFormViewController.m */,
|
||||
);
|
||||
@@ -336,7 +322,6 @@
|
||||
2843EB4F18D4CFA100F13E2B /* Others */,
|
||||
2843EB4818D496CB00F13E2B /* Selectors */,
|
||||
2850C60A18D0F706002B7D0A /* AppDelegate.h */,
|
||||
BFD5D6F41AD2FFC1006F04FA /* PredicateExamples */,
|
||||
282C5EEF18D33C1800A5D47C /* Inputs */,
|
||||
2843EB4518D4915800F13E2B /* ExamplesFormViewController.h */,
|
||||
2843EB4618D4915800F13E2B /* ExamplesFormViewController.m */,
|
||||
@@ -488,20 +473,6 @@
|
||||
name = CustomRows;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BFD5D6F41AD2FFC1006F04FA /* PredicateExamples */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BF9DB1D11AE0436600B985E7 /* BlogExampleViewController.h */,
|
||||
BF9DB1D21AE0436600B985E7 /* BlogExampleViewController.m */,
|
||||
BF9DB1D31AE0436600B985E7 /* PredicateFormViewController.h */,
|
||||
BF9DB1D41AE0436600B985E7 /* PredicateFormViewController.m */,
|
||||
BFE91AF91AE159B200DE5231 /* BasicPredicateViewController.h */,
|
||||
BFE91AFA1AE159B200DE5231 /* BasicPredicateViewController.m */,
|
||||
);
|
||||
name = PredicateExamples;
|
||||
path = Examples/PredicateDisabling;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -610,7 +581,6 @@
|
||||
3CDAFC7A1AB0AFA4000F75B6 /* CustomRowsViewController.m in Sources */,
|
||||
28A7663B1932EA1F00D69546 /* UserLocalDataLoader.m in Sources */,
|
||||
282EB27C1AB5FF33004A736F /* AccessoryViewFormViewController.m in Sources */,
|
||||
BF9DB1D51AE0436600B985E7 /* BlogExampleViewController.m in Sources */,
|
||||
2850C60818D0F706002B7D0A /* main.m in Sources */,
|
||||
D51B8B2C19126664008C0478 /* XLFormCustomCell.m in Sources */,
|
||||
28A7664D1932EE0B00D69546 /* User.m in Sources */,
|
||||
@@ -622,7 +592,6 @@
|
||||
28468E9818EC686500DBB015 /* NativeEventFormViewController.m in Sources */,
|
||||
3C3B01DA1AB7497D0027CD45 /* XLFormWeekDaysCell.m in Sources */,
|
||||
28F89F2E1AA4EA5600E90218 /* ValidationExamplesFormViewController.m in Sources */,
|
||||
66B6266E1AE0055100007886 /* DateAndTimeValueTrasformer.m in Sources */,
|
||||
3C3B01D51AB741EF0027CD45 /* XLFormRatingCell.m in Sources */,
|
||||
28A7665E1932F61100D69546 /* DynamicSelectorsFormViewController.m in Sources */,
|
||||
281E5BE919538F4A006D93C5 /* CLLocationValueTrasformer.m in Sources */,
|
||||
@@ -633,9 +602,7 @@
|
||||
283B59B219532415000828CD /* MapViewController.m in Sources */,
|
||||
2843EB4718D4915800F13E2B /* ExamplesFormViewController.m in Sources */,
|
||||
28A766451932EC9C00D69546 /* CoreDataStore.m in Sources */,
|
||||
BF9DB1D61AE0436600B985E7 /* PredicateFormViewController.m in Sources */,
|
||||
28A7663C1932EA1F00D69546 /* UserRemoteDataLoader.m in Sources */,
|
||||
BFE91AFB1AE159B200DE5231 /* BasicPredicateViewController.m in Sources */,
|
||||
2843EB5218D4CFC700F13E2B /* OthersFormViewController.m in Sources */,
|
||||
2843EB4B18D496F600F13E2B /* SelectorsFormViewController.m in Sources */,
|
||||
28468EA418EF41D300DBB015 /* InputsFormViewController.m in Sources */,
|
||||
|
||||
@@ -1,40 +1,15 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"filename" : "xl_appicon_58.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "57x57",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "xl_appicon_57.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "57x57",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "xl_appicon_114.png",
|
||||
"filename" : "xl_appicon_80.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
@@ -47,117 +22,6 @@
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "50x50",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "50x50",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "72x72",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "72x72",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "xl_appicon_76.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "xl_appicon_152.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "car",
|
||||
"size" : "120x120",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "24x24",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "notificationCenter",
|
||||
"subtype" : "38mm"
|
||||
},
|
||||
{
|
||||
"size" : "27.5x27.5",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "notificationCenter",
|
||||
"subtype" : "42mm"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "watch",
|
||||
"role" : "companionSettings",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "watch",
|
||||
"role" : "companionSettings",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "appLauncher",
|
||||
"subtype" : "38mm"
|
||||
},
|
||||
{
|
||||
"size" : "44x44",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "longLook",
|
||||
"subtype" : "42mm"
|
||||
},
|
||||
{
|
||||
"size" : "86x86",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "quickLook",
|
||||
"subtype" : "38mm"
|
||||
},
|
||||
{
|
||||
"size" : "98x98",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "quickLook",
|
||||
"subtype" : "42mm"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 823 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 883 B |
|
After Width: | Height: | Size: 1.2 KiB |
@@ -3,7 +3,7 @@
|
||||
XLForm
|
||||
|
||||
Created by Martin Barreto on 4/4/14.
|
||||
Copyright (c) 2015 Xmartlabs. All rights reserved.
|
||||
Copyright (c) 2014 Xmartlabs. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// main.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs. All rights reserved.
|
||||
// Copyright (c) 2014 Xmartlabs. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
PODS:
|
||||
- XLForm (2.1.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- XLForm (from `../../`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
XLForm:
|
||||
:path: ../../
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
XLForm: c87bc94f769f52ce32793282d72d2fb15d0d5638
|
||||
|
||||
COCOAPODS: 0.35.0
|
||||
@@ -12,7 +12,7 @@ XLForm is the most flexible and powerful iOS library to create dynamic table-vie
|
||||
|
||||
XLForm provides a very powerful DSL used to create a form. It keeps track of this specification on runtime, updating the UI on the fly.
|
||||
|
||||
#####Let's see the iOS Calendar Event Form created using XLForm
|
||||
#####Let's see the iOS 7 Calendar Event Form created using XLForm
|
||||
|
||||
|
||||

|
||||
@@ -23,16 +23,12 @@ What XLForm does
|
||||
|
||||
* Loads a form based on a declarative [*form definition*](#how-to-create-a-form "form definition").
|
||||
* Keeps track of definition changes on runtime to update the form interface accordingly. Further information on [*Dynamic Forms*](#dynamic-forms---how-to-change-the-form-dynamically-at-runtime "Dynamic Forms") section of this readme.
|
||||
* Supports multivalued sections allowing us to create, delete or reorder rows. For further details see [*Multivalued Sections*](#multivalued-sections "Multivalued Sections") section bellow.
|
||||
* Supports multivalued sections. For further details see [*Multivalued Sections*](#multivalued-sections "Multivalued Sections") section bellow.
|
||||
* Supports [*custom rows definition*](#how-to-create-a-custom-row).
|
||||
* Supports custom selectors. For further details of how to define your own selectors check [*Custom selectors*](#custom-selectors---selector-row-with-a-custom-selector-view-controller "Custom Selectors") section out.
|
||||
* Provides several inline selectors such as date picker and picker inline selectors and brings a way to create custom inline selectors.
|
||||
* Form data validation based on form definition.
|
||||
* Ability to easily navigate among rows, fully customizable.
|
||||
* Ability to show inputAccessoryView if needed. By default a navigation input accessory view is shown.
|
||||
* Read only mode for a particular row or the entire form.
|
||||
* Rows can be hidden or shown depending on other rows values. This can be done declaratively using `NSPredicates`. (see [*Make a row or section invisible depending on other rows values*](#make-a-row-or-section-invisible-depending-on-other-rows-values "Using Predicates"))
|
||||
|
||||
* Validates the form data based on form definition and shows error messages.
|
||||
* Changes the firstResponder among `UITextField`s and `UITextView`s when keyboard return button is pressed.
|
||||
|
||||
|
||||
How to create a form
|
||||
@@ -48,7 +44,7 @@ To define a form we use 3 classes:
|
||||
|
||||
A form definition is a `XLFormDescriptor` instance that contains one or more sections (`XLFormSectionDescriptor` instances) and each section contains several rows (`XLFormRowDescriptor` instance). As you may have noticed the DSL structure is analog to the structure of a `UITableView` (Table -->> Sections -- >> Rows). The resulting table-view form's structure (sections and rows order) mirrors the definition's structure.
|
||||
|
||||
#####Let's see part of the iOS Calendar Event Form definition.
|
||||
#####Let's see part of the iOS 7 Calendar Event Form definition.
|
||||
|
||||
|
||||
```objc
|
||||
@@ -96,9 +92,8 @@ How to run XLForm examples
|
||||
---------------------------------
|
||||
|
||||
1. Clone the repository `git@github.com:xmartlabs/XLForm.git`. Optionally you can fork the repository and clone it from your own github account, this approach would be better in case you want to contribute.
|
||||
2. Move to either the Objective-c or Swift [example folder](/Examples).
|
||||
3. Install example project cocoapod dependencies. From inside Objective-c or Swift example folder run `pod install`.
|
||||
4. Open XLForm or SwiftExample workspace using XCode and run the project. Enjoy!
|
||||
2. Install cocoapod dependencies of example project. From the root folder of the cloned XLForm repository run `pod install`.
|
||||
3. Open XLForm workspace using XCode and run the project. Enjoy!
|
||||
|
||||
|
||||
|
||||
@@ -215,18 +210,20 @@ static NSString *const XLFormRowDescriptorTypeMultipleSelector = @"multipleSelec
|
||||
```
|
||||
|
||||
|
||||
Normally we will have a collection of object to select (these objects should have a string to display them and a value in order to serialize them), XLForm has to be able to display these objects.
|
||||
Normally we will have a collection of object to select (these objects should have a string to display them and a value in order to serialize them), XLForm has to be able to display these objects as well as to be able to create the object HTTP parameter properly.
|
||||
|
||||
XLForm follows the following rules to display an object:
|
||||
|
||||
1. If the value of the `XLFormRowDescriptor` object is nil, XLForm uses the `noValueDisplayText` row property as display text.
|
||||
2. If the XLFormRowDescriptor instance has a `valueTransformer` property value. XLForm uses the `NSValueTransformer` to convert the selected object to a NSString.
|
||||
3. If the object is a `NSString` or `NSNumber` it uses the object `description` property.
|
||||
4. If the object conforms to protocol `XLFormOptionObject`, XLForm gets the display value from `formDisplayText` method.
|
||||
5. Otherwise it return nil. That means you should conforms the protocol `:)`.
|
||||
1. If the object is a `NSString` or `NSNumber` it uses the object `description` property.
|
||||
2. If the object conforms to protocol `XLFormOptionObject`, XLForm gets the display value from `formDisplayText` method.
|
||||
3. Otherwise it return nil. That means you should conforms the protocol `:)`.
|
||||
|
||||
|
||||
You may be interested in change the display text either by setting up `noValueDisplayText` or `valueTransformer` property or making the selector options objects to conform to `XLFormOptionObject` protocol.
|
||||
XLForm follows the following rules to get the option value:
|
||||
|
||||
1. If the object is a `NSString`, `NSNumber` or `NSDate` it uses the object itself as the option value.
|
||||
2. If the object conforms to protocol `XLFormOptionObject`, XLForm gets the option value from `formValue` method.
|
||||
3. Otherwise it return nil. That means you should conforms the protocol :).
|
||||
|
||||
|
||||
This is the protocol declaration:
|
||||
@@ -242,9 +239,9 @@ This is the protocol declaration:
|
||||
```
|
||||
|
||||
|
||||
####Date & Time Rows
|
||||
####Date Rows
|
||||
|
||||
XLForms supports 3 types of dates: `Date`, `DateTime` , `Time` and `Countdown Timer` and it's able to present the `UIDatePicker` control in 2 different ways, inline and non-inline.
|
||||
XLForms supports 3 types of dates: `Date`, `DateTime` and `Time` and it's able to present the `UIDatePicker` control in 2 different ways, inline and non-inline.
|
||||
|
||||

|
||||
|
||||
@@ -261,10 +258,6 @@ static NSString *const XLFormRowDescriptorTypeDateTimeInline = @"datetimeInline"
|
||||
static NSString *const XLFormRowDescriptorTypeTimeInline = @"timeInline";
|
||||
```
|
||||
|
||||
```objc
|
||||
static NSString *const XLFormRowDescriptorTypeCountDownTimerInline = @"countDownTimerInline";
|
||||
```
|
||||
|
||||
```objc
|
||||
static NSString *const XLFormRowDescriptorTypeDate = @"date";
|
||||
```
|
||||
@@ -277,10 +270,6 @@ static NSString *const XLFormRowDescriptorTypeDateTime = @"datetime";
|
||||
static NSString *const XLFormRowDescriptorTypeTime = @"time";
|
||||
```
|
||||
|
||||
```objc
|
||||
static NSString *const XLFormRowDescriptorTypeCountDownTimer = @"countDownTimer";
|
||||
```
|
||||
|
||||
Here is an example of how to define these row types:
|
||||
|
||||
|
||||
@@ -308,11 +297,6 @@ row.value = [NSDate new];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDateTimeInline rowType:XLFormRowDescriptorTypeDateTimeInline title:@"Date Time"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
// CountDownTimer
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCountDownTimerInline rowType:XLFormRowDescriptorTypeCountDownTimerInline title:@"Countdown Timer"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
```
|
||||
|
||||
|
||||
@@ -331,7 +315,7 @@ static NSString *const XLFormRowDescriptorTypeBooleanCheck = @"booleanCheck";
|
||||
static NSString *const XLFormRowDescriptorTypeBooleanSwitch = @"booleanSwitch";
|
||||
```
|
||||
|
||||
We can also simulate other types of Boolean rows using any of the Selector Row Types introduced in the [Selector Rows section](#selector-rows).
|
||||
We can also simulate other types of Boolean rows using any of the Selector Row Types introduced in the Selector Rows section.
|
||||
|
||||
|
||||
####Other Rows
|
||||
@@ -367,44 +351,24 @@ You can adjust the slider for your own interests very easily:
|
||||
|
||||
Set `steps` to `@(0)` to disable the steps functionality.
|
||||
|
||||
#####Info
|
||||
|
||||
Sometimes our apps needs to show data that are not editable. XLForm provides us with `XLFormRowDescriptorTypeInfo` row type to display not editable info. An example of usage would be showing the app version in the settings part of an app.
|
||||
|
||||
#####Button
|
||||
|
||||
Apart from data entry rows, not editable rows and selectors, XLForm has a button row `XLFormRowDescriptorTypeButton` that allows us to do any action when selected. It can be configured using a block (clousure), a selector, a segue identifier, segue class or specifing a view controller to be presented. ViewController specification could be done by setting up the view controller class, the view controller storyboard Id or a nib name. Nib name must match view controller class name.
|
||||
|
||||
|
||||
Multivalued Sections (Insert, Delete, Reorder rows)
|
||||
Multivalued Sections
|
||||
------------------------
|
||||
|
||||
Any `XLFormSectionDescriptor` object can be set up to support row insertion, deletion or reodering. It is possible to enable only one of these modes, a combination or all together.
|
||||
A multivalued section is just a section that support either of these modes.
|
||||
|
||||
The most interesting part of multivalued `XLFormSectionDescriptor` is that it supports all the types of rows that were shown on the [*Rows*](#rows "Rows") section as well as custom rows.
|
||||
Any `XLFormSectionDescriptor` could be set up to support multivalued rows. Multivalued Sections let the user enter multiple values (of the same type) for a field by adding or removing rows.
|
||||
The most interesting part of multivalued `XLFormSectionDescriptor` is that it supports all the types of rows that were shown on the [*Rows*](#rows "Rows") section.
|
||||
|
||||

|
||||
|
||||
|
||||
### How to set up a multivalued section
|
||||
|
||||
Creating a multivalued section is as simple as use one of the following convenience `XLFormSectionDescriptor` initializer:
|
||||
To create a multivalued section we should set `YES` to the `isMultivaluedSection` property of `XLFormSectionDescriptor`. We can also do that creating the `XLFormSectionDescriptor` instance using the this alternative constructor:
|
||||
|
||||
```objc
|
||||
+(id)formSectionWithTitle:(NSString *)title
|
||||
sectionOptions:(XLFormSectionOptions)sectionOptions;
|
||||
+(id)formSectionWithTitle:(NSString *)title
|
||||
sectionOptions:(XLFormSectionOptions)sectionOptions
|
||||
sectionInsertMode:(XLFormSectionInsertMode)sectionInsertMode;
|
||||
+(id)formSectionWithTitle:(NSString *)title multivaluedSection:(BOOL)multivaluedSection;
|
||||
```
|
||||
|
||||
`sectionOptions` is a bitwise enum parameter that should be used to choose the multivalued section type/s (insert, delete, reorder). Available options are `XLFormSectionOptionCanInsert`, `XLFormSectionOptionCanDelete`, `XLFormSectionOptionCanReorder`. `XLFormSectionOptionNone` is the value used by default.
|
||||
|
||||
`sectionInsertMode` can be used to select how the insertion mode will look like. `XLform` has 2 different insertion modes out of the box: `XLFormSectionInsertModeLastRow` and `XLFormSectionInsertModeButton`. `XLFormSectionInsertModeLastRow` is the default value.
|
||||
|
||||
|
||||
**Let's see how to create a multivalued section**
|
||||
We have also to set up the `multiValuedTag` property. `multiValuedTag` will be used to create the HTTP parameter key for the collection of values (rows added to the section).
|
||||
|
||||
```objc
|
||||
XLFormDescriptor * form;
|
||||
@@ -415,17 +379,15 @@ NSArray * nameList = @[@"family", @"male", @"female", @"client"];
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Multivalued examples"];
|
||||
|
||||
// Enable Insertion, Deletion, Reordering
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"MultiValued TextField"
|
||||
sectionOptions:XLFormSectionOptionCanReorder | XLFormSectionOptionCanInsert | XLFormSectionOptionCanDelete];
|
||||
section.multivaluedTag = @"textFieldRow";
|
||||
// MultivaluedSection section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"MultiValued TextField" multivaluedSection:YES];
|
||||
section.multiValuedTag = @"textFieldRow";
|
||||
[form addFormSection:section];
|
||||
|
||||
for (NSString * tag in nameList) {
|
||||
// add a row to the section, each row will represent a name of the name list array.
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeText title:nil];
|
||||
[[row cellConfig] setObject:@"Add a new tag" forKey:@"textField.placeholder"];
|
||||
row.value = [tag copy];
|
||||
[[row cellConfig] setObject:@"Add a new tag" forKey:@"textField.placeholder"];row.value = [tag copy];
|
||||
[section addFormRow:row];
|
||||
}
|
||||
// add an empty row to the section.
|
||||
@@ -435,90 +397,84 @@ row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescrip
|
||||
```
|
||||
|
||||
|
||||
|
||||
Form Values
|
||||
------------------------
|
||||
|
||||
#### formValues
|
||||
|
||||
You can get all form values invoking `-(NSDictionary *)formValues;` either `XLFormViewController` instance or `XLFormDescriptor` instance.
|
||||
You can get all form values invoking `-(NSDictionary *)formValues;` to either `XLFormViewController` instance or `XLFormDescriptor` instance.
|
||||
|
||||
The returned `NSDictionary` is created following this rules:
|
||||
|
||||
`XLForm` adds a value for each `XLFormRowDescriptor` that belongs to a `XLFormSectionDescriptor` doesn't have a `multivaluedTag` value set up. The dictionary key is the value of `XLFormRowDescriptor` `tag` property.
|
||||
`XLForm` adds a value for each `XLFormRowDescriptor` instance not contained in a multivalued section, the dictionary key is the value of `XLFormRowDescriptor` `tag` property.
|
||||
|
||||
For each section that has a `multivaluedTag` value, XLForm adds a dictionary item with a `NSArray` as a value, each value of the array is the value of each row contained in the section, and the key is the `multivaluedTag`.
|
||||
|
||||
For instance, if we have a section with the `multivaluedTag` property equal to `tags` and the following values on the contained rows: 'family', 'male', 'female', 'client', the generated value will be `tags: ['family', 'male', 'female', 'client']`
|
||||
It also adds a dictionary item for each multivalued section containing an `NSArray` with the instance values of the `XLFormRowDescriptor`s contained in the section.
|
||||
For instance, if we have a section with the tag property equal to `tags` and the following values on the contained rows: 'family', 'male', 'female', 'client', the generated value will be `tags: ['family', 'male', 'female', 'client']`
|
||||
|
||||
|
||||
#### httpParameters
|
||||
|
||||
In same cases the form value we need may differ from the value of `XLFormRowDescriptor` instance. This is usually the case of selectors row and when we need to send the form values to some endpoint, the selected value could be a core data object or any other object. In this cases `XLForm` need to know how to get the value and the description of the selected object.
|
||||
In same cases the form value we need may differ from the value of `XLFormRowDescriptor` instance. This is usually the case of selectors row and when we need to send the form values to some endpoint, the selected value could be a core data object or any other object. In this cases XLForm need to know how to get the value and the description of the selected object.
|
||||
|
||||
When using `-(NSDictionary *)httpParameters` method, XLForm follows the following rules to get `XLFormRowDescriptor` value:
|
||||
When using `-(NSDictionary *)httpParameters` method, `XLForm` follows the following rules to get `XLFormRowDescriptor` value:
|
||||
|
||||
1. If the object is a `NSString`, `NSNumber` or `NSDate`, the value is the object itself.
|
||||
1. If the object is a `NSString`, `NSNumber` or `NSDate`, the value is the object itself
|
||||
2. If the object conforms to protocol `XLFormOptionObject`, XLForm gets the value from `formValue` method.
|
||||
3. Otherwise it return nil.
|
||||
|
||||
`multivaluedTag` works in the same way as in `formValues` method.
|
||||
|
||||
|
||||
How to create a Custom Row
|
||||
-------------------------------
|
||||
|
||||
To create a custom cell you need to create a UITableViewCell extending from `XLFormBaseCell`. `XLFormBaseCell` conforms to `XLFormDescriptorCell` protocol.
|
||||
|
||||
You may be interested in implement `XLFormDescriptorCell` methods to change the cell behaviour.
|
||||
This is the protocol declaration:
|
||||
|
||||
```objc
|
||||
@protocol XLFormDescriptorCell <NSObject>
|
||||
@protocol XLFormOptionObject <NSObject>
|
||||
|
||||
@required
|
||||
|
||||
@property (nonatomic, weak) XLFormRowDescriptor * rowDescriptor;
|
||||
|
||||
// initialise all objects such as Arrays, UIControls etc...
|
||||
-(void)configure;
|
||||
// update cell when it about to be presented
|
||||
-(void)update;
|
||||
|
||||
@optional
|
||||
|
||||
// height of the cell
|
||||
+(CGFloat)formDescriptorCellHeightForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor;
|
||||
// called to check if cell can became first responder
|
||||
-(BOOL)formDescriptorCellCanBecomeFirstResponder;
|
||||
// called to ask cell to assign first responder to relevant UIView.
|
||||
-(BOOL)formDescriptorCellBecomeFirstResponder;
|
||||
// called when cell is selected
|
||||
-(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller;
|
||||
// http parameter name used for network request
|
||||
-(NSString *)formDescriptorHttpParameterName;
|
||||
|
||||
// is invoked when cell becomes firstResponder, could be used for change how the cell looks like when it's the forst responder.
|
||||
-(void)highlight;
|
||||
// is invoked when cell resign firstResponder
|
||||
-(void)unhighlight;
|
||||
|
||||
-(NSString *)formDisplayText;
|
||||
-(id)formValue;
|
||||
|
||||
@end
|
||||
```
|
||||
|
||||
|
||||
Once a custom cell has been created you need to let `XLForm` know about this cell by adding the row definition to `cellClassesForRowDescriptorTypes` dictionary.
|
||||
How to create a Custom Row
|
||||
-------------------------------
|
||||
|
||||
To create a custom cell you should conform to @protocol `XLFormDescriptorCell` within your custom `UITableViewCell`. You can also sublass the convenience class `XLFormBaseCell` which conforms to `XLFormDescriptorCell`. In your implementation add the following required methods:
|
||||
|
||||
```objc
|
||||
[[XLFormViewController cellClassesForRowDescriptorTypes] setObject:[MYCustomCellClass class] forKey:kMyAppCustomCellType];
|
||||
// initialise all objects such as Arrays, UIControls etc...
|
||||
- (void)configure;
|
||||
|
||||
// update cell when it about to be presented
|
||||
- (void)update;
|
||||
```
|
||||
|
||||
or, in case we have used nib file to define the `XLBaseDescriptorCell`:
|
||||
Add optional methods to create custom behaviour
|
||||
|
||||
```objc
|
||||
[[XLFormViewController cellClassesForRowDescriptorTypes] setObject:@"nibNameWithoutNibExtension" forKey:kMyAppCustomCellType];
|
||||
// height of the cell
|
||||
+(CGFloat)formDescriptorCellHeightForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor;
|
||||
|
||||
// called when cell wants to become active
|
||||
-(BOOL)formDescriptorCellBecomeFirstResponder;
|
||||
|
||||
// called when cell requested to loss first responder
|
||||
-(BOOL)formDescriptorCellResignFirstResponder;
|
||||
|
||||
// called when cell been selected
|
||||
-(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller;
|
||||
|
||||
// called to validate cell, return error or nil if there no error
|
||||
-(NSError *)formDescriptorCellLocalValidation;
|
||||
|
||||
// http parameter name used for network request
|
||||
-(NSString *)formDescriptorHttpParameterName;
|
||||
|
||||
```
|
||||
|
||||
Doing that, XLForm will instantiate the proper cell class when kMyAppCustomCellType row type is used.
|
||||
Once custom cell has been created you have to let `XLFormRowDescriptor` know about this class either setting the cellClass property i.e `customRowDescriptor.cellClass = [XLFormCustomCell class]` or before `XLFormViewController` initialized add your custom cell to cellClassesForRowDescriptorTypes dictionary i.e `[[XLFormViewController cellClassesForRowDescriptorTypes] setObject:[MYCustomCellClass class] forKey:kMyAppCustomCellType];`
|
||||
|
||||
|
||||
|
||||
Custom Selectors - Selector Row with a custom selector view controller
|
||||
@@ -538,11 +494,6 @@ Define the previous selector row is as simple as ...
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorMap rowType:XLFormRowDescriptorTypeSelectorPush title:@"Coordinate"];
|
||||
// set up the selector controller class
|
||||
row.action.viewControllerClass = [MapViewController class];
|
||||
// or
|
||||
//row.action.viewControllerStoryboardId = @"MapViewControllerStoryboardId";
|
||||
// or
|
||||
//row.action.viewControllerNibName = @"MapViewControllerNibName";
|
||||
|
||||
// Set up a NSValueTransformer to convert CLLocation to NSString, it's used to show the select value description (text).
|
||||
row.valueTransformer = [CLLocationValueTrasformer class];
|
||||
// Set up the default value
|
||||
@@ -568,6 +519,8 @@ XLForm sets up `rowDescriptor` property using the `XLFormRowDescriptor` instance
|
||||
The developer is responsible for update its views with the `rowDescriptor` value as well as set the selected value to `rowDescriptor` from within the custom selector view controller.
|
||||
|
||||
|
||||
|
||||
|
||||
#### Another example
|
||||
|
||||
|
||||
@@ -579,25 +532,23 @@ row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorUser rowType:XLForm
|
||||
row.action.viewControllerClass = [UsersTableViewController class];
|
||||
```
|
||||
|
||||
You can find the details of these examples within the example repository folder, [Examples/Objective-C/Examples/Selectors/CustomSelectors/](Examples/Objective-C/Examples/Selectors/CustomSelectors) and [Examples/Objective-C/Examples/Selectors/DynamicSelector](Examples/Objective-C/Examples/Selectors/DynamicSelector).
|
||||
You can find the details of these examples within the example repository folder, `Examples/Selectors/CustomSelectors/` and `Examples/Selectors/DynamicSelector`.
|
||||
|
||||
|
||||
|
||||
Dynamic Forms - How to change the form dynamically at runtime
|
||||
-------------------------------
|
||||
|
||||
Any change made on the `XLFormDescriptor` will be reflected on the `XLFormViewController` tableView. That means that when a section or a row is added or removed XLForm will animate the section or row accordingly.
|
||||
Any change made on the `XLFormDescriptor` will be reflected on the `XLFormViewController` tableView. That means that we can add or remove sections or rows at any time and XLForm will animate the section or row accordingly.
|
||||
|
||||
We shouldn't have to deal with `NSIndexPaths` or add, remove `UITableViewCell` anymore. `NSIndexPath` of a specific `TableViewCell` changes along the time and this makes very hard to keep track of the `NSIndexPath` of each `UITableViewCell`.
|
||||
We shouldn't have again to work with `NSIndexPaths` or add, remove `UITableViewCell`. `NSIndexPath` of a specific `TableViewCell` changes along the time and this makes very hard to keep track of the `NSIndexPath` of each `UITableViewCell`.
|
||||
|
||||
Each XLForm `XLFormRowDescriptor` row has a `tag` property that is set up in its constructor. `XLFormDescriptor` has, among other helpers, an specific one to get a `XLFormRowDescriptor` from a `tag`.
|
||||
On XLForm, each `XLFormRowDescriptor` has a `tag` property that is set up in its constructor. `XLFormDescriptor` has, among other helpers, an specific one to get a `XLFormRowDescriptor` from a `tag`.
|
||||
It's much easier to manage `XLFormRowDescriptor`s using tags, the tag should be unique and it doesn't change on tableview additions modifications or deletions.
|
||||
|
||||
It's important to keep in mind that all the `UITableView` form modifications have to be made using the descriptors and not making modifications directly on the `UITableView`.
|
||||
It's important keep in mind that all the `UITableView` form modifications have to be made using the descriptors and not making modifications directly on the `UITableView`.
|
||||
|
||||
Usually you may want to change the form when some value change or some row or section is added or removed. For this you can set the `disabled` and `hidden` properties of the rows or sections. For more details see [*Make a row or section invisible depending on other rows values*](#make-a-row-or-section-invisible-depending-on-other-rows-values "Using Predicates").
|
||||
|
||||
In order to stay in sync with the form descriptor modifications your `XLFormViewController` subclass should override the `XLFormDescriptorDelegate` methods of 'XLFormViewController'.
|
||||
Usually you may want to change the form when some value change or some row or section is added or removed. In order to keep posted about the form descriptor modifications your `XLFormViewController` subclass should override the `XLFormDescriptorDelegate` methods of 'XLFormViewController'.
|
||||
|
||||
```objc
|
||||
@protocol XLFormDescriptorDelegate <NSObject>
|
||||
@@ -618,7 +569,6 @@ For instance if we want to show or hide a row depending on the value of another
|
||||
```objc
|
||||
-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
|
||||
{
|
||||
// super implmentation MUST be called
|
||||
[super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
|
||||
if ([rowDescriptor.tag isEqualToString:@"alert"]){
|
||||
if ([[rowDescriptor.value valueData] isEqualToNumber:@(0)] == NO && [[oldValue valueData] isEqualToNumber:@(0)]){
|
||||
@@ -633,107 +583,89 @@ For instance if we want to show or hide a row depending on the value of another
|
||||
}
|
||||
```
|
||||
|
||||
Make a row or section invisible depending on other rows values
|
||||
--------------------------------
|
||||
|
||||
###Summary
|
||||
|
||||
XLForm allows you to define dependencies between rows so that if the value of one row is changed, the behaviour of another one changes automatically. For example, you might have a form where you question the user if he/she has pets. If the answer is 'yes' you might want to ask how their names are.
|
||||
So you can make a row invisible and visible again based on the values of other rows. The same happens with sections.
|
||||
Take a look at the following example:
|
||||
|
||||

|
||||
|
||||
Of course, you could also do this manually by observing the value of some rows and deleting and adding rows accordingly, but that would be a lot of work which is already done.
|
||||
|
||||
###How it works
|
||||
|
||||
To make the appearance and disappearance of rows and sections automatic, there is a property in each descriptor:
|
||||
|
||||
```objc
|
||||
@property id hidden;
|
||||
```
|
||||
|
||||
This id object will normally be a NSPredicate or a NSNumber containing a BOOL. It can be set using any of them or eventually a NSString from which a NSPredicate will be created. In order for this to work the string has to be sintactically correct.
|
||||
|
||||
For example, you could set the following string to a row (`second`) to make it disappear when a previous row (`first`) contains the value "hide".
|
||||
|
||||
```objc
|
||||
second.hidden = [NSString stringWithFormat:@"$%@ contains[c] 'hide'", first];
|
||||
```
|
||||
This will insert the tag of the `first` after the '$', you can do that manually as well, of course. When the predicate is evaluated every tag variable gets substituted by the corresponding row descriptor.
|
||||
|
||||
When the argument is a NSString, a '.value' will be appended to every tag unless the tag is followed by '.isHidden' or '.isDisabled'. This means that a row (or section) might depend on the `value` or the `hidden` or `disabled` properties of another row. When the property is set with a NSPredicate directly, its formatString will not be altered (so you have to append a '.value' after each variable if you want to refer to its value). Setting a NSString is the simplest way but some complex predicates might not work so for those you should directly set a NSPredicate.
|
||||
|
||||
You can also set this properties with a bool object which means the value of the property will not change unless manually set.
|
||||
|
||||
To get the evaluated boolean value the `isHidden` method should be called. It will not re-evaluate the predicate each time it gets called but just when the value (or hidden/disabled status) of the rows it depends on changes. When this happens and the return value changes, it will automagically reflect that change on the form so that no other method must be called.
|
||||
|
||||
Here is another example, this time a bit more complex:
|
||||
|
||||

|
||||
|
||||
|
||||
Disabling rows (set to read-only mode)
|
||||
--------------------------------
|
||||
|
||||
Rows can be disabled so that the user can not change them. By default disabled rows have a gray text color. To disable a row the only thing that has to be done is setting its disabled property:
|
||||
|
||||
```objc
|
||||
@property id disabled;
|
||||
```
|
||||
This property expects a NSNumber containing a BOOL, a NSString or a NSPredicate. A bool will statically disable (or enable the row). The other two work just like the hidden property explained in the section above. This means a row can be disabled and enabled depending on the values of other rows. When a NSString is set, a NSPredicate will be generated taking the string as format string so that it has to be consistent for that purpose.
|
||||
|
||||
A difference to the hidden property is that checking the disabled status of a row does not automatically reflect that value on the form. Tharefore, the XLFormViewController's updateFormRow method should be called.
|
||||
|
||||
|
||||
Validations
|
||||
Open form in Popover
|
||||
------------------------------------
|
||||
|
||||
We can validate the form data using XLForm validation support.
|
||||
|
||||
Each `XLFormRowDescriptor` instance contains a list of validators. We can add validators, remove validators and validate a particular row using these methods:
|
||||
Configure your row with `XLFormRowDescriptorTypeSelectorPopover`
|
||||
|
||||
```objc
|
||||
-(void)addValidator:(id<XLFormValidatorProtocol>)validator;
|
||||
-(void)removeValidator:(id<XLFormValidatorProtocol>)validator;
|
||||
-(XLFormValidationStatus *)doValidation;
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:rowTag rowType:XLFormRowDescriptorTypeSelectorPopover title:@"PickerForm"];
|
||||
```
|
||||
|
||||
We can define our own custom validators just defining a object that conforms to `XLFormValidatorProtocol`.
|
||||
Implement protocols `XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController` in your custom form class:
|
||||
|
||||
```objc
|
||||
@protocol XLFormValidatorProtocol <NSObject>
|
||||
#import "XLFormRowDescriptor.h"
|
||||
#import "XLForm.h"
|
||||
|
||||
@required
|
||||
|
||||
-(XLFormValidationStatus *)isValid:(XLFormRowDescriptor *)row;
|
||||
@interface PickerForm : UITableViewController <XLFormRowDescriptorViewController,XLFormRowDescriptorPopoverViewController, UITableViewDelegate, UITableViewDataSource>
|
||||
|
||||
@end
|
||||
```
|
||||
|
||||
[XLFormRegexValidator](XLForm/XL/Validation/XLFormRegexValidator.h) is an example of a validator we can create.
|
||||
Implement button to allow user to dismiss popover, synthesize popoverController:
|
||||
|
||||
```objc
|
||||
@implementation PickerForm
|
||||
|
||||
@synthesize rowDescriptor;
|
||||
@synthesize popoverController;
|
||||
|
||||
|
||||
A very common validation is ensuring that a value is not empty or nil. XLFom exposes `required` XLFormRowDescriptor property to specify required rows.
|
||||
-(void)viewDidLoad{
|
||||
[super viewDidLoad];
|
||||
self.navigationController.navigationBarHidden=NO;
|
||||
self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(dismiss)];
|
||||
}
|
||||
|
||||
-(void)dismiss{
|
||||
[self.popoverController dismissPopoverAnimated:YES];
|
||||
}
|
||||
```
|
||||
|
||||
To get all rows validation errors we can invoke the following `XLFormViewController` method:
|
||||
```objc
|
||||
Also dismiss popover on row select:
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
self.rowDescriptor.value=[XLFormOptionsObject formOptionsObjectWithValue:@(indexPath.row) displayText:@""];
|
||||
[self.popoverController dismissPopoverAnimated:YES];
|
||||
}
|
||||
```
|
||||
|
||||
Validations
|
||||
------------------------------------
|
||||
|
||||
XLForm supports 2 types of app validation so far.
|
||||
|
||||
* Is Required Validation.
|
||||
* Email validation.
|
||||
|
||||
Improving XLForms validation support is in the roadmap.
|
||||
|
||||
XLForm shows one error at a time showing it as `UIAlertView`.
|
||||
|
||||
You may want to change the list of validation errors. You can do that overriding the following method of `XLFormViewController`, please make sure you call superclass implementation.
|
||||
|
||||
```objc
|
||||
-(NSArray *)formValidationErrors;
|
||||
```
|
||||
|
||||
You can also change the way the error messages are shown overriding:
|
||||
|
||||
```objc
|
||||
-(void)showFormValidationError:(NSError *)error;
|
||||
```
|
||||
|
||||
|
||||
Additional configuration of Rows
|
||||
--------------------------------
|
||||
|
||||
`XLFormRowDescriptor` allow us to configure generic aspects of a `UITableViewCell`, for example: the `rowType`, the `label`, the `value` (default value), if the cell is `required`, `hidden` or `disabled`, and so on.
|
||||
`XLFormRowDescriptor` allow us to configure generic aspects of a `UITableViewCell`, for example: the `rowType`, the `label`, the `value` (default value), if the cell is `required` or `disabled`, and so on.
|
||||
|
||||
You may want to set up another properties of the `UITableViewCell`. To set up another properties `XLForm` makes use of [Key-Value Coding](https://developer.apple.com/LIBRARY/IOS/documentation/Cocoa/Conceptual/KeyValueCoding/Articles/KeyValueCoding.html "Key-Value Coding") allowing the developer to set the cell properties by keyPath.
|
||||
|
||||
You just have to add the properties to `cellConfig` or `cellConfigAtConfigure` dictionary property of `XLFormRowDescriptor`.
|
||||
The main difference between `cellConfig` and `cellConfigAtConfigure` is the time when the property is set up. `cellConfig` properties are set up each time a cell is about to be displayed. `cellConfigAtConfigure`, on the other hand, set up the property just after the init method of the cell is called and only one time.
|
||||
The main difference between `cellConfig` and `cellConfigAtConfigure` is the time when the property is set up. `cellConfig` properties are set up each time before display a cell. `cellConfigAtConfigure`, on the other hand, set up the property just after the init method of the cell is called and only one time.
|
||||
|
||||
|
||||
For instance if you want to set up the placeholder you can do the following:
|
||||
@@ -752,7 +684,6 @@ row = [XLFormRowDescriptor formRowDescriptorWithTag:@"title" rowType:XLFormRowDe
|
||||
[section addFormRow:row];
|
||||
```
|
||||
|
||||
|
||||
FAQ
|
||||
-------
|
||||
|
||||
@@ -816,7 +747,7 @@ If you need something different, you can iterate over each row...
|
||||
[multiValuedValuesArray addObject:row.value];
|
||||
}
|
||||
}
|
||||
[result setObject:multiValuedValuesArray forKey:section.multivaluedTag];
|
||||
[result setObject:multiValuedValuesArray forKey:section.multiValuedTag];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -834,26 +765,6 @@ You can change the font or any other table view cell property using the `cellCon
|
||||
|
||||
For further details, please take a look at [UICustomizationFormViewController.m](/Examples/Objective-C/Examples/UICustomization/UICustomizationFormViewController.m) example.
|
||||
|
||||
####How to disable the entire form (read only mode).
|
||||
|
||||
`disable` XLFormDescriptor property can be used to disable the entire form. In order to make the displayed cell to take effect we should reload the visible cells ( [self.tableView reloadData] ).
|
||||
Any other row added after form `disable` property is set to `YES` will reflect the disable mode automatically (no need to reload table view).
|
||||
|
||||
####How to hide a row or section when another rows value changes.
|
||||
|
||||
To hide a row or section you should set its hidden property. The easiest way of doing this is by setting a NSString to it. Let's say you want a section to hide if a previous row, which is a boolean switch, is set to 1 (or YES). Then you would do something like this:
|
||||
```objc
|
||||
section.hidden = [NSString stringWithFormat:@"$%@ == 1", previousRow];
|
||||
```
|
||||
That is all!
|
||||
|
||||
####What do I have to do to migrate from version 2.2.0 to 3.0.0?
|
||||
|
||||
The only thing that is not compatible with older versions is that the `disabled` property of the `XLFormRowDescriptor` is an `id` now. So you just have to add `@` before the values you set to it like this:
|
||||
```objc
|
||||
row.disabled = @YES; // before: row.disabled = YES;
|
||||
```
|
||||
|
||||
|
||||
Installation
|
||||
--------------------------
|
||||
@@ -861,7 +772,7 @@ Installation
|
||||
The easiest way to use XLForm in your app is via [CocoaPods](http://cocoapods.org/ "CocoaPods").
|
||||
|
||||
1. Add the following line in the project's Podfile file:
|
||||
`pod 'XLForm', '~> 3.0.0'`.
|
||||
`pod 'XLForm', '~> 2.1.0'`.
|
||||
2. Run the command `pod install` from the Podfile folder directory.
|
||||
|
||||
XLForm **has no** dependencies over other pods.
|
||||
@@ -894,43 +805,9 @@ Requirements
|
||||
Release Notes
|
||||
--------------
|
||||
|
||||
Version 3.0.0 (master)
|
||||
|
||||
* `hidden`, `disable` properties added to `XLFormRowDescriptor`. `@YES` `@NO` or a `NSPredicate` can be used to hide, disable de row.
|
||||
* `hidden` property added to `XLFormSectionDescriptor`. `@YES` `@NO` or a `NSPredicate` can be used to hide the section.
|
||||
* Added `XLFormRowDescriptorTypeCountDownTimerInline` and `XLFormRowDescriptorTypeCountDownTimer` row type with an example.
|
||||
* Deleted `dateFormatter` property and added support to use the `NSValueTransformer` to convert the selected object to a NSString in the XLFormDateCell class.
|
||||
* Added `XLFormRowDescriptorTypeCountDownTimerInline` and `XLFormRowDescriptorTypeCountDownTimer` row type with an example.
|
||||
* Deleted `dateFormatter` property and added support to use the `NSValueTransformer` to convert the selected object to a NSString in the XLFormDateCell class.
|
||||
* Added example in the ```Multivalued Sections examples``` of how to add dynamic sections with multiple rows.
|
||||
|
||||
|
||||
Version 2.2.0
|
||||
Version 2.1.1 (master)
|
||||
|
||||
* Fixed "(null)" caption when `XLFormRowDescriptorTypeSelectorLeftRight` row required error message is shown.
|
||||
* Refresh the cell content instead of recreating one, when the form get back from a selection.
|
||||
* Added XLFormRowDescriptor to validations error to easily show an error mask.
|
||||
* Use row tag in validation error message if row does not have a title. It is also possible to set up a custom message if needed
|
||||
* Added a convenience method to add a XLFormRowDescriptor instance before another one.
|
||||
* Allow nil values in cellConfig and cellConfigAtConfigure.
|
||||
* Fix constraints for textFieldCell when it is configured to be right aligned.
|
||||
* Add asterisk to required segmentedCells if needed.
|
||||
* Fail validation for empty strings and NSNull on required rows.
|
||||
* Segue support added to buttons and selectors.
|
||||
* Ability to configure a storyboardId or a viewController nibName to by used by button and selector rows as presented view controller.
|
||||
* Fix scrolling to top when status bar is tapped.
|
||||
* Fix wrong type of XLFormRowDescriptorTypeDecimal row. Now it's converted to NSNumber.
|
||||
* Fix issue: XLFormRegexValidator only checks regex validation for NSStrings, not working for number.
|
||||
* Callconfigure method from awakeFromNib on XLFormBaseCell.
|
||||
* Assign form.delegate from inside setForm: method.
|
||||
* Added custom cell, validation, reordering, can insert, can delete examples.
|
||||
* Added support for inputAccessoryView. Default input accessory view allows to navigate among rows. Fully optionally and customizable.
|
||||
* Added suport for row navigation. Fully optionally and customizable.
|
||||
* beginEditing: endEditing: methods added. These method are called each time a row gains / loses firstResponder. They bring the ability to do UI changes.
|
||||
* Read Only mode added. `disable` property added to XLFormDescriptor class.
|
||||
* Rename `label` XLFormTextViewCell property as `textLabel`.
|
||||
* fix position of multivalued section accessory view.
|
||||
* Can delete, can delete, can reorder section mode added. it's possible to enable some of them, don't need to enable all modes.
|
||||
|
||||
Version 2.1.0
|
||||
|
||||
@@ -978,15 +855,12 @@ Version 1.0.0 (cocoaPod)
|
||||
|
||||
* Initial release
|
||||
|
||||
Author
|
||||
-----------------
|
||||
|
||||
[Martin Barreto](https://www.github.com/mtnBarreto "Martin Barreto Github") ([@mtnBarreto](http://twitter.com/mtnBarreto "@mtnBarreto"))
|
||||
|
||||
|
||||
Contact
|
||||
----------------
|
||||
|
||||
Any suggestion or question? Please create a Github issue or reach us out.
|
||||
|
||||
[xmartlabs.com](http://xmartlabs.com) ([@xmartlabs](http://twitter.com/xmartlabs "@xmartlabs"))
|
||||
Martin Barreto, [@mtnBarreto](http://twitter.com/mtnBarreto "@mtnBarreto")
|
||||
|
||||
[xmartlabs.com](http://xmartlabs.com).
|
||||
[@xmartlabs](http://twitter.com/xmartlabs "@xmartlabs")
|
||||
|
||||
@@ -3,5 +3,6 @@ xcodeproj 'XLForm Tests'
|
||||
inhibit_all_warnings!
|
||||
|
||||
platform :ios, '7.0'
|
||||
pod 'Expecta', '~> 0.3.0'
|
||||
pod 'OCMock', '~> 2.1.1'
|
||||
pod 'Expecta', '~> 0.2.1'
|
||||
pod 'XLForm', :path => '../'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0610"
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -49,15 +49,6 @@
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "28657A391990879200CE8180"
|
||||
BuildableName = "XLForm Tests.xctest"
|
||||
BlueprintName = "XLForm Tests"
|
||||
ReferencedContainer = "container:XLForm Tests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
//
|
||||
// UITextField+Test.h
|
||||
// XLForm Tests
|
||||
//
|
||||
// Created by Gaston Borba on 3/25/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UITextField (Test)
|
||||
|
||||
// This category is for simulate the change of the text
|
||||
-(void)changeText:(NSString *)string;
|
||||
|
||||
@end
|
||||
@@ -1,58 +0,0 @@
|
||||
//
|
||||
// UITextField+Test.m
|
||||
// XLForm Tests
|
||||
//
|
||||
// Created by Gaston Borba on 3/25/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import "UITextField+Test.h"
|
||||
|
||||
@implementation UITextField (Test)
|
||||
|
||||
- (void)beginEditing
|
||||
{
|
||||
[self becomeFirstResponder]; // Returns NO ?
|
||||
|
||||
if ([self textFieldShouldBeginEditing]){
|
||||
if ([self.delegate respondsToSelector:@selector(textFieldDidBeginEditing:)]) {
|
||||
[self.delegate textFieldDidBeginEditing:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)endEditing
|
||||
{
|
||||
if ([self textFieldShouldReturn]) {
|
||||
if ([self.delegate respondsToSelector:@selector(textFieldDidEndEditing:)]) {
|
||||
[self.delegate textFieldDidEndEditing:self];
|
||||
}
|
||||
[self resignFirstResponder];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(BOOL)textFieldShouldReturn
|
||||
{
|
||||
if ([self.delegate respondsToSelector:@selector(textFieldShouldReturn:)]) {
|
||||
return [self.delegate textFieldShouldReturn:self];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(BOOL)textFieldShouldBeginEditing
|
||||
{
|
||||
if ([self.delegate respondsToSelector:@selector(textFieldShouldBeginEditing:)]) {
|
||||
return [self.delegate textFieldShouldBeginEditing:self];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(void)changeText:(NSString *)string
|
||||
{
|
||||
[self beginEditing];
|
||||
[self setText:string];
|
||||
[self endEditing];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,100 +0,0 @@
|
||||
//
|
||||
// XLFormViewControllerTestCase.m
|
||||
// XLForm Tests
|
||||
//
|
||||
// Created by Gaston Borba on 3/23/15.
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#import "XLTestCase.h"
|
||||
#import <XLForm/XLFormTextFieldCell.h>
|
||||
#import "UITextField+Test.h"
|
||||
|
||||
static NSString * const kTextFieldCellTag = @"TextFieldCellTag";
|
||||
|
||||
@interface XLFormExampleTest : XLTestCase
|
||||
@end
|
||||
|
||||
@implementation XLFormExampleTest
|
||||
|
||||
|
||||
- (void)testTableViewLoad
|
||||
{
|
||||
// Get the tableView
|
||||
UITableView * tableView = self.formController.tableView;
|
||||
|
||||
// Check if the tableView match with the form descriptor
|
||||
expect([tableView numberOfSections]).to.equal(1);
|
||||
expect([tableView numberOfRowsInSection:0]).to.equal(1);
|
||||
|
||||
UITableViewCell * cell = [self.formController tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
|
||||
// Check if the cell match with the XLFormRowDescriptorTypeText
|
||||
expect(cell).to.beKindOf([XLFormTextFieldCell class]);
|
||||
XLFormTextFieldCell * textFieldCell = (XLFormTextFieldCell *)cell;
|
||||
|
||||
// Check if the title label match with the row descriptor title
|
||||
expect(textFieldCell.textLabel.text).to.equal(@"Title");
|
||||
// Check if the text field match with the row descriptor value
|
||||
expect(textFieldCell.textField.text).to.equal(@"");
|
||||
}
|
||||
|
||||
- (void)testChangeFormDynamically
|
||||
{
|
||||
// Get the tableView
|
||||
UITableView * tableView = self.formController.tableView;
|
||||
|
||||
// Add a new section in the form descriptor
|
||||
XLFormSectionDescriptor * section = [XLFormSectionDescriptor formSectionWithTitle:@"Section"];
|
||||
[self.formController.form addFormSection:section];
|
||||
|
||||
// Add a new row (switch) in the new section
|
||||
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:XLFormRowDescriptorTypeBooleanSwitch rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Title"];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Check if the tableView match with the form descriptor
|
||||
expect([tableView numberOfSections]).to.equal(2);
|
||||
expect([tableView numberOfRowsInSection:0]).to.equal(1);
|
||||
expect([tableView numberOfRowsInSection:1]).to.equal(1);
|
||||
|
||||
// Check if the cell match with the XLFormRowDescriptorTypeBooleanSwitch
|
||||
UITableViewCell * cell = [self.formController tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]];
|
||||
expect(cell).to.beKindOf([XLFormSwitchCell class]);
|
||||
}
|
||||
|
||||
//- (void)testFillTextFieldCell
|
||||
//{
|
||||
// // Get the tableView
|
||||
// UITableView * tableView = self.formController.tableView;
|
||||
//
|
||||
// // Get the cell that correspond to the row descriptor XLFormRowDescriptorTypeText
|
||||
// UITableViewCell * cell = [self.formController tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
|
||||
// XLFormTextFieldCell * textFieldCell = (XLFormTextFieldCell *)cell;
|
||||
// // Get the texfield in the cell
|
||||
// UITextField * textField = textFieldCell.textField;
|
||||
//
|
||||
// // Simulate that change the text on the textfield
|
||||
// [textField changeText:@"Name"];
|
||||
//
|
||||
// // Get the row descriptor XLFormRowDescriptorTypeText
|
||||
// XLFormRowDescriptor * row = [self.formController.form formRowWithTag:kTextFieldCellTag];
|
||||
//
|
||||
// // Check if the text field match with the row descriptor value
|
||||
// expect(row.value).to.equal(@"Name");
|
||||
//}
|
||||
|
||||
#pragma mark - Build Form
|
||||
|
||||
-(void)buildForm
|
||||
{
|
||||
XLFormDescriptor * form = [XLFormDescriptor formDescriptor];
|
||||
XLFormSectionDescriptor * section = [XLFormSectionDescriptor formSection];
|
||||
[form addFormSection:section];
|
||||
|
||||
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:kTextFieldCellTag rowType:XLFormRowDescriptorTypeText title:@"Title"];
|
||||
[section addFormRow:row];
|
||||
|
||||
self.formController.form = form;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -39,15 +39,18 @@
|
||||
|
||||
-(void)buildForm
|
||||
{
|
||||
XLFormDescriptor * form = [XLFormDescriptor formDescriptor];
|
||||
XLFormSectionDescriptor * section = [XLFormSectionDescriptor formSection];
|
||||
[form addFormSection:section];
|
||||
self.formController = [[XLFormViewController alloc] init];
|
||||
self.formController.form = [XLFormDescriptor formDescriptor];
|
||||
|
||||
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:XLFormRowDescriptorTypeText rowType:XLFormRowDescriptorTypeText title:@"Title"];
|
||||
XLFormSectionDescriptor * section = [XLFormSectionDescriptor formSection];
|
||||
[self.formController.form addFormSection:section];
|
||||
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:XLFormRowDescriptorTypeText rowType:XLFormRowDescriptorTypeText title:@"Required XLFormRowDescriptorTypeText"];
|
||||
row.required = YES;
|
||||
[section addFormRow:row];
|
||||
|
||||
self.formController.form = form;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -10,14 +10,12 @@
|
||||
|
||||
#define EXP_SHORTHAND YES
|
||||
#import "Expecta.h"
|
||||
#import "OCMock.h"
|
||||
|
||||
#import <XLForm/XLForm.h>
|
||||
#import <XLForm/NSString+XLFormAdditions.h>
|
||||
|
||||
@interface XLTestCase : XCTestCase
|
||||
|
||||
@property (nonatomic, strong) XLFormViewController * formController;
|
||||
|
||||
-(void)buildForm;
|
||||
|
||||
@end
|
||||
|
||||
@@ -10,43 +10,4 @@
|
||||
|
||||
@implementation XLTestCase
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
[self buildForm];
|
||||
[self forceLoadingOfTheView]; // Load the view
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
self.formController = nil;
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Helpers
|
||||
|
||||
-(void)buildForm
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
-(XLFormViewController *)formController
|
||||
{
|
||||
if (_formController) return _formController;
|
||||
_formController = [[XLFormViewController alloc] init];
|
||||
return _formController;
|
||||
}
|
||||
|
||||
|
||||
- (void)forceLoadingOfTheView
|
||||
{
|
||||
// This triggers to load the view
|
||||
expect(self.formController.view).notTo.beNil();
|
||||
self.formController.view.frame = CGRectMake(0, 0, 375, 667);
|
||||
[self.formController.view layoutIfNeeded];
|
||||
// [self.formController.tableView reloadData];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
//
|
||||
// testHideAndShow.m
|
||||
// XLForm Tests
|
||||
//
|
||||
// Created by mathias Claassen on 10/4/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "XLTestCase.h"
|
||||
|
||||
|
||||
static NSString * const kTextFieldCellTag = @"TextTag";
|
||||
static NSString * const kIntegerFieldCellTag = @"IntegerTag";
|
||||
static NSString * const kDisabledFieldCellTag = @"DisabledTag";
|
||||
|
||||
@interface XLFormDescriptor (_XLTestAdditions)
|
||||
|
||||
@property (readonly) NSMutableDictionary* allRowsByTag;
|
||||
@property NSMutableDictionary* rowObservers;
|
||||
|
||||
@end
|
||||
|
||||
@interface XLTestHideAndShow : XLTestCase
|
||||
@end
|
||||
|
||||
@implementation XLTestHideAndShow
|
||||
|
||||
- (void)testBasicPredicates {
|
||||
// Get the tableView
|
||||
UITableView * tableView = self.formController.tableView;
|
||||
|
||||
// Check if the tableView matches with the form descriptor
|
||||
expect([tableView numberOfSections]).to.equal(2);
|
||||
expect([tableView numberOfRowsInSection:0]).to.equal(2);
|
||||
|
||||
XLFormTextFieldCell * textFieldCell = (XLFormTextFieldCell*) [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
|
||||
XLFormTextFieldCell * disabledFieldCell = (XLFormTextFieldCell*) [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]];
|
||||
|
||||
//Let's disable the row of the second section. The second row of the first section should hide.
|
||||
textFieldCell.rowDescriptor.value = @"dis";
|
||||
|
||||
expect(disabledFieldCell.rowDescriptor.isDisabled).to.beTruthy;
|
||||
|
||||
expect([tableView numberOfSections]).to.equal(2);
|
||||
expect([tableView numberOfRowsInSection:0]).to.equal(1);
|
||||
|
||||
// Now hide the second section. As the row will be enabled, the second row of the first section should reappear
|
||||
textFieldCell.rowDescriptor.value = @"hide that section";
|
||||
|
||||
expect(disabledFieldCell.rowDescriptor.isDisabled).to.beFalsy;
|
||||
|
||||
expect([tableView numberOfSections]).to.equal(1);
|
||||
expect([tableView numberOfRowsInSection:0]).to.equal(2);
|
||||
|
||||
//Now we disable the last row (even if its hidden) and consecuently the second row hides again.
|
||||
textFieldCell.rowDescriptor.value = @"dishide";
|
||||
|
||||
expect([tableView numberOfSections]).to.equal(1);
|
||||
expect([tableView numberOfRowsInSection:0]).to.equal(1);
|
||||
|
||||
//Now everything should be as at the beginning
|
||||
textFieldCell.rowDescriptor.value = @"Hello World";
|
||||
|
||||
expect([tableView numberOfSections]).to.equal(2);
|
||||
expect([tableView numberOfRowsInSection:0]).to.equal(2);
|
||||
}
|
||||
|
||||
-(void)testInternalDataStructures{
|
||||
UITableView * tableView = self.formController.tableView;
|
||||
|
||||
XLFormRowDescriptor* disabledRow = ((XLFormTextFieldCell*) [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]]).rowDescriptor;
|
||||
NSMutableDictionary* deps = self.formController.form.rowObservers;
|
||||
NSMutableDictionary* rows = self.formController.form.allRowsByTag;
|
||||
|
||||
expect(rows[kDisabledFieldCellTag]).to.equal(disabledRow);
|
||||
expect(rows[kIntegerFieldCellTag]).to.equal(((XLFormTextFieldCell*) [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]]).rowDescriptor);
|
||||
expect(rows[kTextFieldCellTag]).to.equal(((XLFormTextFieldCell*) [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]).rowDescriptor);
|
||||
|
||||
expect(deps[[kDisabledFieldCellTag formKeyForPredicateType:XLPredicateTypeHidden ]]).to.equal(@[kIntegerFieldCellTag]);
|
||||
expect(deps[[kIntegerFieldCellTag formKeyForPredicateType:XLPredicateTypeHidden ]]).to.equal(nil);
|
||||
expect(deps[[kTextFieldCellTag formKeyForPredicateType:XLPredicateTypeHidden]]).to.equal(@[disabledRow.sectionDescriptor]);
|
||||
expect(deps[[kTextFieldCellTag formKeyForPredicateType:XLPredicateTypeDisabled]]).to.equal(@[kDisabledFieldCellTag]);
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Build Form
|
||||
|
||||
-(void)buildForm
|
||||
{
|
||||
XLFormDescriptor * form = [XLFormDescriptor formDescriptor];
|
||||
self.formController.form = form;
|
||||
|
||||
XLFormSectionDescriptor * section = [XLFormSectionDescriptor formSection];
|
||||
[self.formController.form addFormSection:section];
|
||||
|
||||
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:kTextFieldCellTag rowType:XLFormRowDescriptorTypeText title:@"Title"];
|
||||
[section addFormRow:row];
|
||||
|
||||
XLFormRowDescriptor * row2 = [XLFormRowDescriptor formRowDescriptorWithTag:kIntegerFieldCellTag rowType:XLFormRowDescriptorTypeInteger title:@"Number"];
|
||||
row2.hidden = [NSString stringWithFormat:@"$%@.isDisabled == 1", kDisabledFieldCellTag];
|
||||
[section addFormRow:row2];
|
||||
|
||||
XLFormSectionDescriptor * section2 = [XLFormSectionDescriptor formSection];
|
||||
section2.hidden = [NSString stringWithFormat:@"$%@ contains[c] 'hide'", row];
|
||||
[self.formController.form addFormSection:section2];
|
||||
|
||||
XLFormRowDescriptor * row3 = [XLFormRowDescriptor formRowDescriptorWithTag:kDisabledFieldCellTag rowType:XLFormRowDescriptorTypeEmail title:@"Email"];
|
||||
row3.disabled = [NSString stringWithFormat:@"$%@ contains[c] 'dis'", row];
|
||||
[section2 addFormRow:row3];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -1,14 +1,14 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'XLForm'
|
||||
s.version = '3.0.0'
|
||||
s.version = '2.1.0'
|
||||
s.license = { :type => 'MIT' }
|
||||
s.summary = 'XLForm is the most flexible and powerful iOS library to create dynamic table-view forms.'
|
||||
s.description = <<-DESC
|
||||
s.description = <<-DESC
|
||||
The goal of the library is to get the same power of hand-made forms but spending 1/10 of the time. XLForm provides a very powerful DSL used to create a form, validate & serialize the form data. It keeps track of this specification on runtime, updating the UI on the fly.
|
||||
DESC
|
||||
s.homepage = 'https://github.com/xmartlabs/XLForm'
|
||||
s.authors = { 'Martin Barreto' => 'martin@xmartlabs.com' }
|
||||
s.source = { :git => 'https://github.com/xmartlabs/XLForm.git', :tag => 'v3.0.0' }
|
||||
s.source = { :git => 'https://github.com/xmartlabs/XLForm.git', :tag => 'v2.1.0' }
|
||||
s.source_files = 'XLForm/XL/**/*.{h,m}'
|
||||
s.requires_arc = true
|
||||
s.ios.deployment_target = '7.0'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// XLFormBaseCell.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// XLFormBaseCell.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -51,26 +51,17 @@
|
||||
{
|
||||
_rowDescriptor = rowDescriptor;
|
||||
[self update];
|
||||
[rowDescriptor.cellConfig enumerateKeysAndObjectsUsingBlock:^(NSString *keyPath, id value, BOOL * __unused stop) {
|
||||
[self setValue:(value == [NSNull null]) ? nil : value forKeyPath:keyPath];
|
||||
}];
|
||||
if (rowDescriptor.isDisabled){
|
||||
[rowDescriptor.cellConfigIfDisabled enumerateKeysAndObjectsUsingBlock:^(NSString *keyPath, id value, BOOL * __unused stop) {
|
||||
[self setValue:(value == [NSNull null]) ? nil : value forKeyPath:keyPath];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)configure
|
||||
{
|
||||
//override
|
||||
}
|
||||
|
||||
- (void)update
|
||||
{
|
||||
self.textLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
|
||||
self.detailTextLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
|
||||
self.textLabel.textColor = self.rowDescriptor.isDisabled ? [UIColor grayColor] : [UIColor blackColor];
|
||||
// override
|
||||
}
|
||||
|
||||
-(void)highlight
|
||||
@@ -129,4 +120,28 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
-(void)setAccessoryType:(UITableViewCellAccessoryType)accessoryType
|
||||
{
|
||||
[super setAccessoryType:accessoryType];
|
||||
[super setEditingAccessoryType:accessoryType];
|
||||
}
|
||||
|
||||
-(void)setAccessoryView:(UIView *)accessoryView
|
||||
{
|
||||
[super setAccessoryView:accessoryView];
|
||||
[super setEditingAccessoryView:accessoryView];
|
||||
}
|
||||
|
||||
-(void)setEditingAccessoryType:(UITableViewCellAccessoryType)editingAccessoryType
|
||||
{
|
||||
[self setAccessoryType:editingAccessoryType];
|
||||
}
|
||||
|
||||
-(void)setEditingAccessoryView:(UIView *)editingAccessoryView
|
||||
{
|
||||
[self setAccessoryView:editingAccessoryView];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// XLFormButtonCell.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// XLFormButtonCell.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -44,13 +44,13 @@
|
||||
-(void)update
|
||||
{
|
||||
[super update];
|
||||
BOOL isDisabled = self.rowDescriptor.isDisabled;
|
||||
self.textLabel.text = self.rowDescriptor.title;
|
||||
BOOL leftAligmnment = self.rowDescriptor.action.viewControllerClass || [self.rowDescriptor.action.viewControllerStoryboardId length] != 0 || [self.rowDescriptor.action.viewControllerNibName length] != 0 || [self.rowDescriptor.action.formSegueIdenfifier length] != 0 || self.rowDescriptor.action.formSegueClass;
|
||||
self.textLabel.textAlignment = leftAligmnment ? NSTextAlignmentLeft : NSTextAlignmentCenter;
|
||||
self.accessoryType = !leftAligmnment || isDisabled ? UITableViewCellAccessoryNone : UITableViewCellAccessoryDisclosureIndicator;;
|
||||
self.editingAccessoryType = self.accessoryType;
|
||||
self.selectionStyle = isDisabled ? UITableViewCellSelectionStyleNone : UITableViewCellSelectionStyleDefault;
|
||||
self.accessoryType = leftAligmnment ? UITableViewCellAccessoryDisclosureIndicator: UITableViewCellAccessoryNone;
|
||||
self.textLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
|
||||
self.textLabel.textColor = self.rowDescriptor.disabled ? [UIColor grayColor] : [UIColor blackColor];
|
||||
self.selectionStyle = self.rowDescriptor.disabled ? UITableViewCellSelectionStyleNone : UITableViewCellSelectionStyleDefault;
|
||||
}
|
||||
|
||||
|
||||
|
||||