Compare commits
233 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bd2a64b881 | |||
| 403a63ec1f | |||
| 4d3d916b07 | |||
| 6ef46a6026 | |||
| 5f376c5e85 | |||
| 0ca45c77c4 | |||
| 2c3c6f6089 | |||
| 31ecb76df2 | |||
| e98e09c8c6 | |||
| 82c6bf29e1 | |||
| 772ab0c53e | |||
| 6aba1f17ed | |||
| 970c64620d | |||
| ccffa8600b | |||
| cb01471cdc | |||
| 103e71e508 | |||
| 77b119d4d5 | |||
| f2d5882614 | |||
| ac0d5991e0 | |||
| 33715f3154 | |||
| cd506db478 | |||
| 9a89d1bd5c | |||
| 8495a150ed | |||
| 8c4ecfb86b | |||
| 3661646d54 | |||
| 3f1bb84308 | |||
| 8c12875aa2 | |||
| fa203c250e | |||
| f60922b38a | |||
| d18edfbae2 | |||
| 1347ce56ee | |||
| 9dc985bf3b | |||
| 764e3f9bc6 | |||
| a4fc47d5b0 | |||
| 38ef82c4df | |||
| 53f60c3287 | |||
| 95fe4f2cbc | |||
| 19e286bee9 | |||
| 0f83bf6e1b | |||
| 9d20dbbf42 | |||
| 7a602ab61b | |||
| 1904ca3e10 | |||
| f521bce859 | |||
| f2d4146782 | |||
| 06fd66c537 | |||
| 61430b0194 | |||
| ab8b4c979e | |||
| dbe81fe484 | |||
| 08eaf70f62 | |||
| 134e764100 | |||
| f2be2d3c29 | |||
| e196fc711b | |||
| 368501511d | |||
| d88235b028 | |||
| 23b93a1a70 | |||
| 1738fb8e35 | |||
| c3be940cc4 | |||
| dddbb74e95 | |||
| ef90f35a0f | |||
| c03878e656 | |||
| 853254d75e | |||
| 460b116018 | |||
| 6a501e21fb | |||
| 6725d0a9b4 | |||
| daaf720c29 | |||
| bcd9ef118e | |||
| cb9d40ba3a | |||
| afcf2071ed | |||
| 12b7012a1b | |||
| 8632b5bb42 | |||
| ff2d869ee0 | |||
| 486595922f | |||
| 9138c413f1 | |||
| 96c0999bf7 | |||
| 79c14e3346 | |||
| a28b595abd | |||
| 9de19aa0d8 | |||
| d2a99cf8ce | |||
| 029d88a901 | |||
| d454cc284d | |||
| 612807d9c3 | |||
| c8ebb733ce | |||
| 175f10397b | |||
| 094715028c | |||
| 169f9f9778 | |||
| 9bc80c6c0d | |||
| ecc9ec45fb | |||
| d479a91f47 | |||
| 014030a99e | |||
| deb34b01b0 | |||
| 79d9412ea3 | |||
| a2feb45ad7 | |||
| bea7afcb60 | |||
| 1854bd49a4 | |||
| bb1d4bedc8 | |||
| ebf4915899 | |||
| 22c8f06d43 | |||
| 47aa759602 | |||
| da241efcc0 | |||
| 09176bff39 | |||
| d3fc9b2093 | |||
| 8c9351cd12 | |||
| 560aec29c6 | |||
| 941f8fcfc3 | |||
| 65c5431761 | |||
| 1c1c95408f | |||
| cda07b2a64 | |||
| 6fac42b190 | |||
| 4a641c4a7c | |||
| a36ae6d90a | |||
| 60657c0cf8 | |||
| a114e9bda5 | |||
| 4113135298 | |||
| 9503cbe8ed | |||
| 36fa5e7071 | |||
| 6566ef81f8 | |||
| f019da0edc | |||
| 20ca33e2e8 | |||
| 31f2fce646 | |||
| 39280687e8 | |||
| 76b9d85154 | |||
| e6661b6526 | |||
| 6e4574836b | |||
| 3822ed74e5 | |||
| 49a2fb8f96 | |||
| 7929580f5d | |||
| 03d8b0a35c | |||
| 7bbfab3c6b | |||
| 84a2f55609 | |||
| 8273745356 | |||
| 2e3e267bfe | |||
| 4c68391763 | |||
| 94f22d9b54 | |||
| d94b027c17 | |||
| 549a6be69f | |||
| 49e30831fe | |||
| a025671a7c | |||
| d938ae2ff2 | |||
| ec32aa367f | |||
| 10d97e6521 | |||
| 3a71cfe6e2 | |||
| 73a2d52754 | |||
| 9805fdca06 | |||
| ef057d9276 | |||
| 12f0666a01 | |||
| fde42a24c9 | |||
| 395ad92609 | |||
| 8583c62371 | |||
| f1da656aed | |||
| f02bcf92c5 | |||
| c0e9260930 | |||
| 69b70c657d | |||
| 9589061a0d | |||
| f4044f6259 | |||
| ff2f0283ff | |||
| 9fada5f4f9 | |||
| 3b54dee1fe | |||
| 514807c473 | |||
| 2702ca48c6 | |||
| f329a71340 | |||
| 9e9289801b | |||
| 1169554708 | |||
| f2408e86a5 | |||
| b085dcb325 | |||
| d67eb7f762 | |||
| 8bbbef613b | |||
| 6a7040e531 | |||
| 73abfd53c2 | |||
| 6e5427d7a4 | |||
| 23c315b479 | |||
| e14ed978c0 | |||
| fb653663e8 | |||
| c5b88338cb | |||
| 8bd5656c67 | |||
| f6f51ea555 | |||
| c17c6ff8dd | |||
| 2782937274 | |||
| 581fdbf561 | |||
| 588a0b8734 | |||
| e2118cba30 | |||
| b817d1270e | |||
| 289603f952 | |||
| eb4b1d67ca | |||
| 5629922247 | |||
| d5da7f807a | |||
| 802fb9a7c4 | |||
| 5bb7a4d82d | |||
| 68d5d367d5 | |||
| 6af0912cf7 | |||
| b6da136929 | |||
| c3683c7ad7 | |||
| 9bc2f91d6b | |||
| 8ff180f6f4 | |||
| 054f1803f0 | |||
| 27f0f78938 | |||
| b738d826f9 | |||
| 2ac23999fb | |||
| e8edb426c2 | |||
| 57fe1a64e2 | |||
| a8094d48b8 | |||
| 730ec7ba58 | |||
| 04b7ee6035 | |||
| f0b7080a80 | |||
| ca201ba888 | |||
| 28e74bd134 | |||
| 8b552c9632 | |||
| bf9f11d307 | |||
| 05bd37f55a | |||
| 75558762bc | |||
| d84f09bf45 | |||
| 6a275dbb56 | |||
| 998a4bc382 | |||
| 9143d6bd90 | |||
| 74be7af750 | |||
| d43ff5c93d | |||
| d2a323feca | |||
| da40cfaf5d | |||
| 176c7bebbe | |||
| 94edd0015e | |||
| d5d10baa41 | |||
| 8de760e951 | |||
| 6f83343d6f | |||
| 8063c91e2d | |||
| 4fb2cb15a2 | |||
| b5b71d5ddf | |||
| 16160b431f | |||
| 2857ab3060 | |||
| 176b301087 | |||
| 51e2adc1b3 | |||
| 67daaae929 | |||
| 552624bbbf | |||
| a209c72e84 | |||
| bea831dfba |
@@ -21,3 +21,5 @@ DerivedData
|
||||
Pods
|
||||
Tests/Pods
|
||||
Tests/Podfile.lock
|
||||
Examples/Objective-C/Podfile.lock
|
||||
Examples/Swift/Podfile.lock
|
||||
@@ -1,4 +1,5 @@
|
||||
language: objective-c
|
||||
osx_image: xcode7.2
|
||||
before_install:
|
||||
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
|
||||
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
|
||||
|
||||
@@ -26,16 +26,22 @@
|
||||
#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
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +60,8 @@ NSString * kAccessoryViewCheck = @"check";
|
||||
NSString * kAccessoryViewNotes = @"notes";
|
||||
|
||||
|
||||
|
||||
|
||||
-(id)init
|
||||
{
|
||||
self = [super init];
|
||||
@@ -69,7 +77,7 @@ NSString * kAccessoryViewNotes = @"notes";
|
||||
formDescriptor.rowNavigationOptions = XLFormRowNavigationOptionEnabled;
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
XLFormRowDescriptor * switchRow;
|
||||
|
||||
// Configuration section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Row Navigation Settings"];
|
||||
@@ -77,33 +85,54 @@ NSString * kAccessoryViewNotes = @"notes";
|
||||
[formDescriptor addFormSection:section];
|
||||
|
||||
// RowNavigationEnabled
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationEnabled rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Row Navigation Enabled?"];
|
||||
row.value = @YES;
|
||||
[section addFormRow:row];
|
||||
switchRow = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationEnabled rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Row Navigation Enabled?"];
|
||||
switchRow.value = @YES;
|
||||
[section addFormRow:switchRow];
|
||||
|
||||
// RowNavigationShowAccessoryView
|
||||
_rowShowAccessoryView = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationShowAccessoryView rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Show input accessory view?"];
|
||||
_rowShowAccessoryView.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionEnabled) == XLFormRowNavigationOptionEnabled);
|
||||
[section addFormRow:_rowShowAccessoryView];
|
||||
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
|
||||
|
||||
// RowNavigationStopDisableRow
|
||||
_rowStopDisableRow = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationStopDisableRow rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Stop when reach disabled row?"];
|
||||
_rowStopDisableRow.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionStopDisableRow) == XLFormRowNavigationOptionStopDisableRow);
|
||||
[section addFormRow:_rowStopDisableRow];
|
||||
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
|
||||
|
||||
// RowNavigationStopInlineRow
|
||||
_rowStopInlineRow = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationStopInlineRow rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Stop when reach inline row?"];
|
||||
_rowStopInlineRow.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionStopInlineRow) == XLFormRowNavigationOptionStopInlineRow);
|
||||
[section addFormRow:_rowStopInlineRow];
|
||||
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
|
||||
|
||||
// RowNavigationSkipCanNotBecomeFirstResponderRow
|
||||
_rowSkipCanNotBecomeFirstResponderRow = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Skip Can Not Become First Responder Row?"];
|
||||
_rowSkipCanNotBecomeFirstResponderRow.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow) == XLFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow);
|
||||
[section addFormRow:_rowSkipCanNotBecomeFirstResponderRow];
|
||||
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
|
||||
|
||||
|
||||
|
||||
// Basic Information - Section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"TextField Types"];
|
||||
section.footerTitle = @"This is a long text that will appear on section footer";
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[formDescriptor addFormSection:section];
|
||||
|
||||
// Name
|
||||
@@ -119,7 +148,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];
|
||||
|
||||
@@ -140,10 +169,10 @@ NSString * kAccessoryViewNotes = @"notes";
|
||||
[row.cellConfigAtConfigure setObject:@"TEXT VIEW EXAMPLE" forKey:@"textView.placeholder"];
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Ckeck"];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Check"];
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"TextView With Label Example"];
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[formDescriptor addFormSection:section];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewNotes rowType:XLFormRowDescriptorTypeTextView title:@"Notes"];
|
||||
[section addFormRow:row];
|
||||
@@ -158,6 +187,7 @@ 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]){
|
||||
@@ -180,7 +210,9 @@ NSString * kAccessoryViewNotes = @"notes";
|
||||
|
||||
}
|
||||
}
|
||||
else if ([rowDescriptor.tag isEqualToString:kAccessoryViewRowNavigationStopDisableRow]){
|
||||
else
|
||||
#endif
|
||||
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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -23,7 +23,6 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import "CoreDataStore.h"
|
||||
#import "ExamplesFormViewController.h"
|
||||
#import "AppDelegate.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// CustomRowsViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -27,11 +27,13 @@
|
||||
#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
|
||||
|
||||
@@ -69,6 +71,12 @@ static NSString * const kCustomRowWeekdays = @"CustomRowWeekdays";
|
||||
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];
|
||||
@@ -86,6 +94,15 @@ static NSString * const kCustomRowWeekdays = @"CustomRowWeekdays";
|
||||
};
|
||||
[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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
NSString * const XLFormRowDescriptorTypeFloatLabeledTextField = @"XLFormRowDescriptorTypeFloatLabeledTextField";
|
||||
|
||||
const static CGFloat kHMargin = 15.0f;
|
||||
const static CGFloat kVMargin = 8.0f;
|
||||
const static CGFloat kFloatingLabelFontSize = 11.0f;
|
||||
|
||||
@@ -77,13 +76,19 @@ const static CGFloat kFloatingLabelFontSize = 11.0f;
|
||||
|
||||
self.floatLabeledTextField.attributedPlaceholder =
|
||||
[[NSAttributedString alloc] initWithString:self.rowDescriptor.title
|
||||
attributes:@{NSForegroundColorAttributeName: [UIColor darkGrayColor]}];
|
||||
attributes:@{NSForegroundColorAttributeName: [UIColor lightGrayColor]}];
|
||||
|
||||
self.floatLabeledTextField.text = self.rowDescriptor.value ? [self.rowDescriptor.value displayText] : self.rowDescriptor.noValueDisplayText;
|
||||
[self.floatLabeledTextField setEnabled:!self.rowDescriptor.disabled];
|
||||
[self.floatLabeledTextField setEnabled:!self.rowDescriptor.isDisabled];
|
||||
|
||||
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.isDisabled;
|
||||
}
|
||||
|
||||
-(BOOL)formDescriptorCellBecomeFirstResponder
|
||||
@@ -91,12 +96,6 @@ const static CGFloat kFloatingLabelFontSize = 11.0f;
|
||||
return [self.floatLabeledTextField becomeFirstResponder];
|
||||
}
|
||||
|
||||
-(BOOL)formDescriptorCellResignFirstResponder
|
||||
{
|
||||
return [self.floatLabeledTextField resignFirstResponder];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UITextFieldDelegate
|
||||
|
||||
- (BOOL)textFieldShouldClear:(UITextField *)textField
|
||||
@@ -155,10 +154,9 @@ const static CGFloat kFloatingLabelFontSize = 11.0f;
|
||||
NSMutableArray * result = [[NSMutableArray alloc] init];
|
||||
|
||||
NSDictionary * views = @{@"floatLabeledTextField": self.floatLabeledTextField};
|
||||
NSDictionary *metrics = @{@"hMargin":@(kHMargin),
|
||||
@"vMargin":@(kVMargin)};
|
||||
NSDictionary *metrics = @{@"vMargin":@(kVMargin)};
|
||||
|
||||
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(hMargin)-[floatLabeledTextField]-(hMargin)-|"
|
||||
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[floatLabeledTextField]-|"
|
||||
options:0
|
||||
metrics:metrics
|
||||
views:views]];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// XLRatingView.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -55,11 +55,8 @@
|
||||
|
||||
- (void)customize
|
||||
{
|
||||
UIColor * grayColor = [UIColor colorWithRed:(205/255.0) green:(201/255.0) blue:(201/255.0) alpha:1];
|
||||
self.baseColor = grayColor;
|
||||
|
||||
UIColor * goldColor = [UIColor colorWithRed:(255/255.0) green:(215/255.0) blue:0 alpha:1];
|
||||
self.highlightColor = goldColor;
|
||||
self.baseColor = [UIColor colorWithRed:(205/255.0) green:(201/255.0) blue:(201/255.0) alpha:1];
|
||||
self.highlightColor = [UIColor colorWithRed:(255/255.0) green:(215/255.0) blue:0 alpha:1];
|
||||
self.markFont = [UIFont systemFontOfSize:23.0f];
|
||||
self.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
self.stepInterval = 1.0f;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// XLFormRatingCell.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -28,6 +28,7 @@
|
||||
extern NSString * const XLFormRowDescriptorTypeRate;
|
||||
|
||||
@interface XLFormRatingCell : XLFormBaseCell
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *rateTitle;
|
||||
@property (weak, nonatomic) IBOutlet XLRatingView *ratingView;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// XLFormRatingCell.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -47,6 +47,9 @@ 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,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
@@ -10,11 +11,12 @@
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="OGo-4x-YLf" customClass="XLFormRatingCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="478" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="OGo-4x-YLf" id="hV6-xt-6pq">
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" tableViewCell="OGo-4x-YLf" id="hV6-xt-6pq">
|
||||
<rect key="frame" x="0.0" y="0.0" width="478" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yhI-dj-sRk" customClass="XLRatingView">
|
||||
<rect key="frame" x="353" y="11" width="115" height="22"/>
|
||||
<rect key="frame" x="355" y="11" width="115" height="22"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="22" id="85e-Ov-qM7"/>
|
||||
@@ -22,28 +24,21 @@
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Rate" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vxp-gw-YTt">
|
||||
<rect key="frame" x="15" y="11" width="338" height="21"/>
|
||||
<rect key="frame" x="8" y="11" width="347" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="IK4-8e-SFs"/>
|
||||
<constraint firstAttribute="width" constant="150" id="hNG-F9-1wj"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="hNG-F9-1wj"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="Vxp-gw-YTt" secondAttribute="bottom" constant="11" id="0Qz-iR-Tzb"/>
|
||||
<constraint firstAttribute="centerY" secondItem="Vxp-gw-YTt" secondAttribute="centerY" id="4Vh-2e-m2p"/>
|
||||
<constraint firstAttribute="trailing" secondItem="yhI-dj-sRk" secondAttribute="trailing" constant="10" id="NPC-r7-JFl"/>
|
||||
<constraint firstAttribute="centerY" secondItem="yhI-dj-sRk" secondAttribute="centerY" id="Vw4-h8-wId"/>
|
||||
<constraint firstItem="Vxp-gw-YTt" firstAttribute="leading" secondItem="hV6-xt-6pq" secondAttribute="leading" constant="15" id="Xgq-Cy-zLQ"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="yhI-dj-sRk" secondAttribute="trailing" id="W8E-PI-peE"/>
|
||||
<constraint firstItem="Vxp-gw-YTt" firstAttribute="top" secondItem="hV6-xt-6pq" secondAttribute="top" constant="11" id="bgO-t8-Rjz"/>
|
||||
<constraint firstItem="Vxp-gw-YTt" firstAttribute="leading" secondItem="hV6-xt-6pq" secondAttribute="leadingMargin" id="mVS-0p-p0O"/>
|
||||
<constraint firstItem="yhI-dj-sRk" firstAttribute="leading" secondItem="Vxp-gw-YTt" secondAttribute="trailing" id="n0B-tg-Pik"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// XLFormWeekDaysCell.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -100,6 +100,14 @@ 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.sundayButton.alpha];
|
||||
[self.tuesdayButton setAlpha:self.sundayButton.alpha];
|
||||
[self.wednesdayButton setAlpha:self.sundayButton.alpha];
|
||||
[self.thursdayButton setAlpha:self.sundayButton.alpha];
|
||||
[self.fridayButton setAlpha:self.sundayButton.alpha];
|
||||
[self.saturdayButton setAlpha:self.sundayButton.alpha];
|
||||
}
|
||||
|
||||
-(NSString *)getDayFormButton:(id)sender
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
@@ -10,11 +11,12 @@
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="60" id="piA-L5-eiN" customClass="XLFormWeekDaysCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="382" height="50"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="piA-L5-eiN" id="Yr6-3E-keb">
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" tableViewCell="piA-L5-eiN" id="Yr6-3E-keb">
|
||||
<rect key="frame" x="0.0" y="0.0" width="382" height="49"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZAg-Me-yKR">
|
||||
<rect key="frame" x="5" y="0.0" width="53" height="49"/>
|
||||
<rect key="frame" x="8" y="0.0" width="52" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="S">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
@@ -28,14 +30,14 @@
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UjQ-Cw-7wH" userLabel="separator 1">
|
||||
<rect key="frame" x="58" y="10" width="1" height="29"/>
|
||||
<rect key="frame" x="60" y="10" width="1" height="29"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="K3N-3h-MZr"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="N3w-qP-kRZ">
|
||||
<rect key="frame" x="58" y="0.0" width="53" height="49"/>
|
||||
<rect key="frame" x="60" y="0.0" width="53" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="M">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
@@ -46,14 +48,14 @@
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kwc-0w-V51" userLabel="separator 2">
|
||||
<rect key="frame" x="111" y="10" width="1" height="29"/>
|
||||
<rect key="frame" x="113" y="10" width="1" height="29"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="3mE-sT-ql1"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cPl-47-rS8">
|
||||
<rect key="frame" x="111" y="0.0" width="53" height="49"/>
|
||||
<rect key="frame" x="113" y="0.0" width="52" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="T">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
@@ -64,14 +66,14 @@
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EiN-2p-Oig" userLabel="separator 3">
|
||||
<rect key="frame" x="164" y="10" width="1" height="29"/>
|
||||
<rect key="frame" x="165" y="10" width="1" height="29"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="JyW-GC-0A7"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6iC-Cl-RyI">
|
||||
<rect key="frame" x="164" y="0.0" width="54" height="49"/>
|
||||
<rect key="frame" x="165" y="0.0" width="52" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="W">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
@@ -82,14 +84,14 @@
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bRc-5e-QAH" userLabel="separator 4">
|
||||
<rect key="frame" x="218" y="10" width="1" height="29"/>
|
||||
<rect key="frame" x="217" y="10" width="1" height="29"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="W9F-iR-Leh"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eTo-Ip-reh">
|
||||
<rect key="frame" x="218" y="0.0" width="53" height="49"/>
|
||||
<rect key="frame" x="217" y="0.0" width="52" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="T">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
@@ -100,14 +102,14 @@
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dHj-rj-mjh" userLabel="separator 5">
|
||||
<rect key="frame" x="271" y="10" width="1" height="29"/>
|
||||
<rect key="frame" x="269" y="10" width="1" height="29"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="h5U-x0-9nJ"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Wjb-tu-QEo">
|
||||
<rect key="frame" x="271" y="0.0" width="53" height="49"/>
|
||||
<rect key="frame" x="269" y="0.0" width="53" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="F">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
@@ -118,14 +120,14 @@
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="L7g-lu-boa" userLabel="separator 6">
|
||||
<rect key="frame" x="324" y="10" width="1" height="29"/>
|
||||
<rect key="frame" x="322" y="10" width="1" height="29"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="81t-Xh-wZT"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LNf-b4-GYP">
|
||||
<rect key="frame" x="324" y="0.0" width="53" height="49"/>
|
||||
<rect key="frame" x="322" y="0.0" width="52" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="S">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
@@ -137,15 +139,9 @@
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="ZAg-Me-yKR" firstAttribute="leading" secondItem="Yr6-3E-keb" secondAttribute="leading" constant="5" id="0EB-cP-ogn"/>
|
||||
<constraint firstItem="6iC-Cl-RyI" firstAttribute="width" secondItem="cPl-47-rS8" secondAttribute="width" id="1ZI-HN-9ew"/>
|
||||
<constraint firstItem="cPl-47-rS8" firstAttribute="leading" secondItem="N3w-qP-kRZ" secondAttribute="trailing" id="1pQ-h0-SEG"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="leading" secondItem="6iC-Cl-RyI" secondAttribute="trailing" constant="1" id="2UA-Ao-KZF"/>
|
||||
<constraint firstItem="dHj-rj-mjh" firstAttribute="height" secondItem="L7g-lu-boa" secondAttribute="height" id="4dj-Xx-ksP"/>
|
||||
<constraint firstAttribute="bottom" secondItem="EiN-2p-Oig" secondAttribute="bottom" constant="10" id="5eK-Bu-wpU"/>
|
||||
<constraint firstItem="N3w-qP-kRZ" firstAttribute="leading" secondItem="ZAg-Me-yKR" secondAttribute="trailing" id="67F-sV-r6W"/>
|
||||
<constraint firstItem="Wjb-tu-QEo" firstAttribute="leading" secondItem="dHj-rj-mjh" secondAttribute="trailing" id="6ZX-Ub-2vw"/>
|
||||
<constraint firstItem="EiN-2p-Oig" firstAttribute="height" secondItem="bRc-5e-QAH" secondAttribute="height" id="7Um-cV-f7p"/>
|
||||
<constraint firstItem="LNf-b4-GYP" firstAttribute="trailing" secondItem="Yr6-3E-keb" secondAttribute="trailingMargin" id="7Kc-RO-8KK"/>
|
||||
<constraint firstItem="LNf-b4-GYP" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="7YT-x4-m88"/>
|
||||
<constraint firstItem="6iC-Cl-RyI" firstAttribute="trailing" secondItem="bRc-5e-QAH" secondAttribute="leading" id="ABd-MQ-9sp"/>
|
||||
<constraint firstAttribute="bottom" secondItem="UjQ-Cw-7wH" secondAttribute="bottom" constant="10" id="ASC-xR-Yxa"/>
|
||||
@@ -153,87 +149,43 @@
|
||||
<constraint firstItem="6iC-Cl-RyI" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="Aac-10-vTs"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="leading" secondItem="6iC-Cl-RyI" secondAttribute="trailing" id="BL5-PL-pac"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ZAg-Me-yKR" secondAttribute="bottom" id="BeZ-ar-qMN"/>
|
||||
<constraint firstItem="dHj-rj-mjh" firstAttribute="height" secondItem="bRc-5e-QAH" secondAttribute="height" id="DYn-Cd-g5H"/>
|
||||
<constraint firstAttribute="bottom" secondItem="kwc-0w-V51" secondAttribute="bottom" constant="10" id="EXu-BP-ftM"/>
|
||||
<constraint firstAttribute="bottom" secondItem="LNf-b4-GYP" secondAttribute="bottom" id="EYe-ne-rqO"/>
|
||||
<constraint firstItem="cPl-47-rS8" firstAttribute="leading" secondItem="N3w-qP-kRZ" secondAttribute="trailing" id="Fo8-Tp-bkn"/>
|
||||
<constraint firstItem="dHj-rj-mjh" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="GYq-pf-vR0"/>
|
||||
<constraint firstItem="cPl-47-rS8" firstAttribute="leading" secondItem="UjQ-Cw-7wH" secondAttribute="trailing" constant="72" id="HQ2-jA-X9g"/>
|
||||
<constraint firstItem="Wjb-tu-QEo" firstAttribute="leading" secondItem="eTo-Ip-reh" secondAttribute="trailing" id="I0s-Ze-pwV"/>
|
||||
<constraint firstAttribute="bottom" secondItem="bRc-5e-QAH" secondAttribute="bottom" constant="10" id="InL-Hk-twg"/>
|
||||
<constraint firstItem="UjQ-Cw-7wH" firstAttribute="leading" secondItem="ZAg-Me-yKR" secondAttribute="trailing" id="Jj4-jg-rdr"/>
|
||||
<constraint firstItem="6iC-Cl-RyI" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" id="KQe-Ei-8jY"/>
|
||||
<constraint firstItem="cPl-47-rS8" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="Kw5-3R-qXs"/>
|
||||
<constraint firstItem="bRc-5e-QAH" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="MXG-vB-U8F"/>
|
||||
<constraint firstItem="ZAg-Me-yKR" firstAttribute="width" secondItem="N3w-qP-kRZ" secondAttribute="width" id="Mem-UJ-5Js"/>
|
||||
<constraint firstItem="L7g-lu-boa" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="OVT-GJ-zq8"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" constant="25" id="OYQ-8o-3j8"/>
|
||||
<constraint firstItem="N3w-qP-kRZ" firstAttribute="width" secondItem="cPl-47-rS8" secondAttribute="width" id="Pl6-Xd-Krq"/>
|
||||
<constraint firstItem="Wjb-tu-QEo" firstAttribute="width" secondItem="LNf-b4-GYP" secondAttribute="width" id="Pro-fg-wBA"/>
|
||||
<constraint firstAttribute="bottom" secondItem="6iC-Cl-RyI" secondAttribute="bottom" id="Q5M-8N-hIh"/>
|
||||
<constraint firstItem="UjQ-Cw-7wH" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="RGn-ja-FRD"/>
|
||||
<constraint firstAttribute="trailing" secondItem="LNf-b4-GYP" secondAttribute="trailing" constant="5" id="RlS-d5-rIx"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="trailing" secondItem="cPl-47-rS8" secondAttribute="leading" id="Rs4-Pl-R8X"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="leading" secondItem="bRc-5e-QAH" secondAttribute="trailing" id="SO9-U6-cVO"/>
|
||||
<constraint firstAttribute="bottom" secondItem="N3w-qP-kRZ" secondAttribute="bottom" id="STf-aE-Y2E"/>
|
||||
<constraint firstAttribute="bottom" secondItem="kwc-0w-V51" secondAttribute="bottom" constant="10" id="SWG-oy-aZJ"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="TAb-IV-m7A"/>
|
||||
<constraint firstAttribute="bottom" secondItem="cPl-47-rS8" secondAttribute="bottom" id="Tmp-md-564"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="height" secondItem="UjQ-Cw-7wH" secondAttribute="height" id="Uli-Qb-6Om"/>
|
||||
<constraint firstItem="6iC-Cl-RyI" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" id="VcV-kz-XBb"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="width" secondItem="6iC-Cl-RyI" secondAttribute="width" id="X0k-jG-o63"/>
|
||||
<constraint firstItem="Wjb-tu-QEo" firstAttribute="leading" secondItem="eTo-Ip-reh" secondAttribute="trailing" id="cOc-P1-ZhU"/>
|
||||
<constraint firstItem="LNf-b4-GYP" firstAttribute="leading" secondItem="Wjb-tu-QEo" secondAttribute="trailing" id="dSr-cr-ebR"/>
|
||||
<constraint firstItem="EiN-2p-Oig" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="fgT-6k-CaP"/>
|
||||
<constraint firstItem="LNf-b4-GYP" firstAttribute="leading" secondItem="Wjb-tu-QEo" secondAttribute="trailing" id="gNl-wJ-ujY"/>
|
||||
<constraint firstItem="ZAg-Me-yKR" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="glN-lT-q1z"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="width" secondItem="Wjb-tu-QEo" secondAttribute="width" id="hEH-9C-pGZ"/>
|
||||
<constraint firstItem="EiN-2p-Oig" firstAttribute="height" secondItem="kwc-0w-V51" secondAttribute="height" id="hOI-fd-H7m"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="i5C-wG-rRN"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="trailing" secondItem="dHj-rj-mjh" secondAttribute="leading" id="jsw-H6-2gQ"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" id="lQE-r9-9JT"/>
|
||||
<constraint firstAttribute="bottom" secondItem="L7g-lu-boa" secondAttribute="bottom" constant="10" id="lv1-xB-0zR"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="leading" secondItem="N3w-qP-kRZ" secondAttribute="trailing" id="oQe-Qf-9ZO"/>
|
||||
<constraint firstItem="Wjb-tu-QEo" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="pn7-s8-fDj"/>
|
||||
<constraint firstItem="EiN-2p-Oig" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" id="qIf-aB-2ZY"/>
|
||||
<constraint firstItem="6iC-Cl-RyI" firstAttribute="leading" secondItem="EiN-2p-Oig" secondAttribute="trailing" id="sAE-Nl-Puc"/>
|
||||
<constraint firstItem="LNf-b4-GYP" firstAttribute="leading" secondItem="L7g-lu-boa" secondAttribute="trailing" id="t1q-Nc-vbg"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="tVL-uj-6Ma"/>
|
||||
<constraint firstItem="Wjb-tu-QEo" firstAttribute="trailing" secondItem="L7g-lu-boa" secondAttribute="leading" id="u3Q-pF-E3A"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Wjb-tu-QEo" secondAttribute="bottom" id="uh4-LM-Ieo"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" constant="25" id="vrx-0B-GOB"/>
|
||||
<constraint firstItem="ZAg-Me-yKR" firstAttribute="leading" secondItem="Yr6-3E-keb" secondAttribute="leadingMargin" id="w9K-VP-JpE"/>
|
||||
<constraint firstAttribute="bottom" secondItem="eTo-Ip-reh" secondAttribute="bottom" id="xIu-Vy-Nff"/>
|
||||
<constraint firstItem="N3w-qP-kRZ" firstAttribute="leading" secondItem="UjQ-Cw-7wH" secondAttribute="trailing" id="xWy-Uf-QEm"/>
|
||||
<constraint firstItem="N3w-qP-kRZ" firstAttribute="leading" secondItem="ZAg-Me-yKR" secondAttribute="trailing" id="xsx-BM-yQ5"/>
|
||||
<constraint firstItem="N3w-qP-kRZ" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="yEX-Wv-CZQ"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="67F-sV-r6W"/>
|
||||
<exclude reference="xWy-Uf-QEm"/>
|
||||
<exclude reference="1pQ-h0-SEG"/>
|
||||
<exclude reference="HQ2-jA-X9g"/>
|
||||
<exclude reference="OYQ-8o-3j8"/>
|
||||
<exclude reference="Rs4-Pl-R8X"/>
|
||||
<exclude reference="SWG-oy-aZJ"/>
|
||||
<exclude reference="TAb-IV-m7A"/>
|
||||
<exclude reference="Uli-Qb-6Om"/>
|
||||
<exclude reference="lQE-r9-9JT"/>
|
||||
<exclude reference="vrx-0B-GOB"/>
|
||||
<exclude reference="KQe-Ei-8jY"/>
|
||||
<exclude reference="sAE-Nl-Puc"/>
|
||||
<exclude reference="7Um-cV-f7p"/>
|
||||
<exclude reference="hOI-fd-H7m"/>
|
||||
<exclude reference="2UA-Ao-KZF"/>
|
||||
<exclude reference="SO9-U6-cVO"/>
|
||||
<exclude reference="6ZX-Ub-2vw"/>
|
||||
<exclude reference="cOc-P1-ZhU"/>
|
||||
<exclude reference="4dj-Xx-ksP"/>
|
||||
<exclude reference="DYn-Cd-g5H"/>
|
||||
<exclude reference="dSr-cr-ebR"/>
|
||||
<exclude reference="t1q-Nc-vbg"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="fridayButton" destination="Wjb-tu-QEo" id="AcP-Qg-i9P"/>
|
||||
@@ -244,7 +196,7 @@
|
||||
<outlet property="tuesdayButton" destination="cPl-47-rS8" id="wIn-mO-cUx"/>
|
||||
<outlet property="wednesdayButton" destination="6iC-Cl-RyI" id="GQe-Oy-pcd"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="296" y="222"/>
|
||||
<point key="canvasLocation" x="443" y="197"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -26,13 +26,16 @@
|
||||
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
|
||||
|
||||
@@ -43,9 +46,10 @@ NSString *const kDateTime = @"dateTime";
|
||||
if (self){
|
||||
XLFormDescriptor * form;
|
||||
XLFormSectionDescriptor * section;
|
||||
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Dates"];
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Date & Time"];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Inline Dates"];
|
||||
[form addFormSection:section];
|
||||
@@ -55,16 +59,26 @@ NSString *const kDateTime = @"dateTime";
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
// DateTime
|
||||
// Time
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kTimeInline rowType:XLFormRowDescriptorTypeTimeInline title:@"Time"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Time
|
||||
// DateTime
|
||||
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"];
|
||||
NSDateComponents * dateComp = [NSDateComponents new];
|
||||
dateComp.hour = 0;
|
||||
dateComp.minute = 7;
|
||||
dateComp.timeZone = [NSTimeZone systemTimeZone];
|
||||
NSCalendar * calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
|
||||
row.value = [calendar dateFromComponents:dateComp];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Dates"];
|
||||
[form addFormSection:section];
|
||||
@@ -76,32 +90,101 @@ NSString *const kDateTime = @"dateTime";
|
||||
[row.cellConfigAtConfigure setObject:[NSDate dateWithTimeIntervalSinceNow:(60*60*24*3)] forKey:@"maximumDate"];
|
||||
[section addFormRow:row];
|
||||
|
||||
// DateTime
|
||||
// Time
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kTime rowType:XLFormRowDescriptorTypeTime title:@"Time"];
|
||||
[row.cellConfigAtConfigure setObject:@(10) forKey:@"minuteInterval"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Time
|
||||
// DateTime
|
||||
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 = [calendar dateFromComponents:dateComp];
|
||||
[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
|
||||
{
|
||||
// super implementation must be called
|
||||
[super formRowDescriptorValueHasChanged:formRow oldValue:oldValue newValue:newValue];
|
||||
if([formRow.tag isEqualToString:kDatePicker])
|
||||
{
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"DatePicker"
|
||||
message:@"Value Has changed!"
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"OK"
|
||||
otherButtonTitles:nil];
|
||||
[message show];
|
||||
#else
|
||||
if ([UIAlertController class]) {
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@"DatePicker"
|
||||
message:@"Value Has changed!"
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:@"OK"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:nil]];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
else{
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"DatePicker"
|
||||
message:@"Value Has changed!"
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"OK"
|
||||
otherButtonTitles:nil];
|
||||
[message show];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ExamplesFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -33,12 +33,18 @@
|
||||
#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 ()
|
||||
@@ -83,7 +89,7 @@ NSString * const kValidations= @"Validations";
|
||||
|
||||
// NativeEventFormViewController
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"realExamples" rowType:XLFormRowDescriptorTypeButton title:@"iOS Calendar Event Form"];
|
||||
row.action.formSegueIdenfifier = @"NativeEventNavigationViewControllerSegue";
|
||||
row.action.formSegueIdentifier = @"NativeEventNavigationViewControllerSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
@@ -99,27 +105,40 @@ NSString * const kValidations= @"Validations";
|
||||
|
||||
// Selectors
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectors rowType:XLFormRowDescriptorTypeButton title:@"Selectors"];
|
||||
row.action.formSegueIdenfifier = @"SelectorsFormViewControllerSegue";
|
||||
row.action.formSegueIdentifier = @"SelectorsFormViewControllerSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
// Dates
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDates rowType:XLFormRowDescriptorTypeButton title:@"Dates"];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDates rowType:XLFormRowDescriptorTypeButton title:@"Date & Time"];
|
||||
row.action.viewControllerClass = [DatesFormViewController class];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Others
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kOthes rowType:XLFormRowDescriptorTypeButton title:@"Other Rows"];
|
||||
row.action.formSegueIdenfifier = @"OthersFormViewControllerSegue";
|
||||
row.action.formSegueIdentifier = @"OthersFormViewControllerSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
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];
|
||||
|
||||
@@ -147,7 +166,22 @@ NSString * const kValidations= @"Validations";
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kValidations rowType:XLFormRowDescriptorTypeButton title:@"Validation Examples"];
|
||||
row.action.formSegueIdenfifier = @"ValidationExamplesFormViewControllerSegue";
|
||||
row.action.formSegueIdentifier = @"ValidationExamplesFormViewControllerSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Using Predicates"];
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredicates rowType:XLFormRowDescriptorTypeButton title:@"Very basic predicates"];
|
||||
row.action.formSegueIdentifier = @"BasicPredicateViewControllerSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredicates rowType:XLFormRowDescriptorTypeButton title:@"Blog Example Hide predicates"];
|
||||
row.action.formSegueIdentifier = @"BlogExampleViewSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredicates rowType:XLFormRowDescriptorTypeButton title:@"Another example"];
|
||||
row.action.formSegueIdentifier = @"PredicateFormViewControllerSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
self.form = form;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// InputsFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -30,6 +30,7 @@
|
||||
NSString *const kName = @"name";
|
||||
NSString *const kEmail = @"email";
|
||||
NSString *const kTwitter = @"twitter";
|
||||
NSString *const kZipCode = @"zipCode";
|
||||
NSString *const kNumber = @"number";
|
||||
NSString *const kInteger = @"integer";
|
||||
NSString *const kDecimal = @"decimal";
|
||||
@@ -68,10 +69,14 @@ 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];
|
||||
|
||||
// Zip Code
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kZipCode rowType:XLFormRowDescriptorTypeZipCode title:@"Zip Code"];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Number
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kNumber rowType:XLFormRowDescriptorTypeNumber title:@"Number"];
|
||||
[section addFormRow:row];
|
||||
@@ -121,7 +126,7 @@ NSString *const kNotes = @"notes";
|
||||
}
|
||||
|
||||
|
||||
-(IBAction)savePressed:(UIBarButtonItem * __unused)button
|
||||
-(void)savePressed:(UIBarButtonItem * __unused)button
|
||||
{
|
||||
NSArray * validationErrors = [self formValidationErrors];
|
||||
if (validationErrors.count > 0){
|
||||
@@ -129,8 +134,34 @@ NSString *const kNotes = @"notes";
|
||||
return;
|
||||
}
|
||||
[self.tableView endEditing:YES];
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Valid Form", nil) message:@"No errors found" delegate:self cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Valid Form", nil)
|
||||
message:@"No errors found"
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"OK", nil)
|
||||
otherButtonTitles:nil];
|
||||
[message show];
|
||||
#else
|
||||
if ([UIAlertController class]){
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Valid Form", nil)
|
||||
message:@"No errors found"
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:nil]];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
|
||||
}
|
||||
else{
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Valid Form", nil)
|
||||
message:@"No errors found"
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"OK", nil)
|
||||
otherButtonTitles:nil];
|
||||
[message show];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// MultiValuedFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -25,6 +25,21 @@
|
||||
|
||||
#import "XLFormViewController.h"
|
||||
|
||||
@interface MultiValuedFormViewController : XLFormViewController
|
||||
@interface MultivaluedFormViewController : XLFormViewController
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface MultivaluedOnlyReorderViewController : XLFormViewController
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface MultivaluedOnlyInserViewController : XLFormViewController
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface MultivaluedOnlyDeleteViewController : XLFormViewController
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// MultiValuedFormViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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,61 +36,41 @@
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
NSArray * nameList = @[@"family", @"male", @"female", @"client"];
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Multivalued Examples"];
|
||||
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"MultiValued Examples"];
|
||||
|
||||
// MultivaluedSection section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"MultiValued TextField" multivaluedSection:YES];
|
||||
section.multiValuedTag = @"textFieldRow";
|
||||
// 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 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 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";
|
||||
// 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 = @[[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"]
|
||||
];
|
||||
row.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3", @"Option 4", @"Option 5"];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
|
||||
// Another one
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"MultiValued Push Selector example" multivaluedSection:YES];
|
||||
section.footerTitle = @"MultiValuedFormViewController.h";
|
||||
section.multiValuedTag = @"multivaluedPushSelector";
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multivalued Push Selector example"
|
||||
sectionOptions:XLFormSectionOptionCanInsert | XLFormSectionOptionCanDelete | XLFormSectionOptionCanReorder
|
||||
sectionInsertMode:XLFormSectionInsertModeButton];
|
||||
section.footerTitle = @"MultivaluedFormViewController.h";
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorPush title:@"Tap to select ;).."];
|
||||
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Option 1"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"]
|
||||
];
|
||||
row.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3"];
|
||||
section.multivaluedRowTemplate = [row copy];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
|
||||
return [super initWithForm:form];
|
||||
}
|
||||
|
||||
@@ -105,11 +85,67 @@
|
||||
|
||||
-(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", nil];
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:nil
|
||||
delegate:self
|
||||
cancelButtonTitle:NSLocalizedString(@"Cancel")
|
||||
destructiveButtonTitle:@"Remove Last Section"
|
||||
otherButtonTitles:@"Add a section at the end", self.form.isDisabled ? @"Enable Form" : @"Disable Form", nil];
|
||||
[actionSheet showInView:self.view];
|
||||
|
||||
#else
|
||||
if ([UIAlertController class]){
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:nil
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil]];
|
||||
__weak __typeof(self)weakSelf = self;
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:@"Remove Last Section"
|
||||
style:UIAlertActionStyleDestructive
|
||||
handler:^(UIAlertAction *action) {
|
||||
if (weakSelf.form.formSections.count > 0){
|
||||
// remove last section
|
||||
[weakSelf.form removeFormSectionAtIndex:(weakSelf.form.formSections.count - 1)];
|
||||
}
|
||||
}]];
|
||||
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:@"Add a section at the end"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
// 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_%@", @(weakSelf.form.formSections.count)];
|
||||
XLFormRowDescriptor * newRow = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorPush title:@"Tap to select ;).."];
|
||||
newRow.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3"];
|
||||
[newSection addFormRow:newRow];
|
||||
[weakSelf.form addFormSection:newSection];
|
||||
}]];
|
||||
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:self.form.isDisabled ? @"Enable Form" : @"Disable Form"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
weakSelf.form.disabled = !weakSelf.form.disabled;
|
||||
[weakSelf.tableView endEditing:YES];
|
||||
[weakSelf.tableView reloadData];
|
||||
}]];
|
||||
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
else{
|
||||
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:nil
|
||||
delegate:self
|
||||
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
|
||||
destructiveButtonTitle:@"Remove Last Section"
|
||||
otherButtonTitles:@"Add a section at the end", self.form.isDisabled ? @"Enable Form" : @"Disable Form", nil];
|
||||
[actionSheet showInView:self.view];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
|
||||
|
||||
#pragma mark - UIActionSheetDelegate
|
||||
|
||||
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||
@@ -122,15 +158,179 @@
|
||||
}
|
||||
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]] multivaluedSection:YES];
|
||||
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]] sectionOptions:XLFormSectionOptionCanInsert | XLFormSectionOptionCanDelete];
|
||||
newSection.multivaluedTag = [NSString stringWithFormat:@"multivaluedPushSelector_%@", @(self.form.formSections.count)];
|
||||
XLFormRowDescriptor * newRow = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorPush title:@"Tap to select ;).."];
|
||||
newRow.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Option 1"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"]];
|
||||
newRow.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3"];
|
||||
[newSection addFormRow:newRow];
|
||||
[self.form addFormSection:newSection];
|
||||
}
|
||||
else if (![[actionSheet buttonTitleAtIndex:buttonIndex] isEqualToString:NSLocalizedString(@"Cancel")]){
|
||||
self.form.disabled = !self.form.disabled;
|
||||
[self.tableView endEditing:YES];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@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: 1.5 MiB After Width: | Height: | Size: 5.1 MiB |
@@ -2,7 +2,7 @@
|
||||
// XLFormCustomCell.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -30,23 +30,20 @@
|
||||
- (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!";
|
||||
}
|
||||
@@ -55,54 +52,9 @@
|
||||
{
|
||||
// custom code here
|
||||
// i.e new behaviour when cell has been selected
|
||||
self.textLabel.text = @"I can do any custom behaviour...";
|
||||
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.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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -82,7 +82,6 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
|
||||
NSLog(@"Failed to download image");
|
||||
}];
|
||||
}
|
||||
[self.textLabel setFont:[UIFont preferredFontForTextStyle:UIFontTextStyleBody]];
|
||||
}
|
||||
|
||||
|
||||
@@ -93,12 +92,57 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
|
||||
|
||||
-(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller
|
||||
{
|
||||
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle delegate:self
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
|
||||
delegate:self
|
||||
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
|
||||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:NSLocalizedString(@"XLFormImageSelectorCell_ChooseExistingPhoto", @"Choose Existing Photo"), NSLocalizedString(@"XLFormImageSelectorCell_TakePicture", @"Take a Picture"), nil];
|
||||
actionSheet.tag = self.tag;
|
||||
[actionSheet showInView:self.formViewController.view];
|
||||
#else
|
||||
if ([UIAlertController class]) {
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:self.rowDescriptor.selectorTitle
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil]];
|
||||
__weak __typeof(self)weakSelf = self;
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"XLFormImageSelectorCell_ChooseExistingPhoto", @"Choose Existing Photo")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
UIImagePickerController * imagePickerController = [[UIImagePickerController alloc] init];
|
||||
imagePickerController.delegate = weakSelf;
|
||||
imagePickerController.allowsEditing = YES;
|
||||
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
|
||||
imagePickerController.mediaTypes = @[(NSString *)kUTTypeImage];
|
||||
[weakSelf.formViewController presentViewController:imagePickerController animated:YES completion:nil];
|
||||
}]];
|
||||
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"XLFormImageSelectorCell_TakePicture", @"Take a Picture")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
UIImagePickerController * imagePickerController = [[UIImagePickerController alloc] init];
|
||||
imagePickerController.delegate = weakSelf;
|
||||
imagePickerController.allowsEditing = YES;
|
||||
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
|
||||
imagePickerController.mediaTypes = @[(NSString *)kUTTypeImage];
|
||||
[weakSelf.formViewController presentViewController:imagePickerController animated:YES completion:nil];
|
||||
}]];
|
||||
|
||||
[self.formViewController presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
else{
|
||||
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
|
||||
delegate:self
|
||||
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
|
||||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:NSLocalizedString(@"XLFormImageSelectorCell_ChooseExistingPhoto", @"Choose Existing Photo"), NSLocalizedString(@"XLFormImageSelectorCell_TakePicture", @"Take a Picture"), nil];
|
||||
actionSheet.tag = self.tag;
|
||||
[actionSheet showInView:self.formViewController.view];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#pragma mark - LayoutConstraints
|
||||
@@ -110,7 +154,7 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
|
||||
|
||||
NSDictionary *metrics = @{@"margin":@5.0};
|
||||
|
||||
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(margin)-[text]" options:0 metrics:metrics views:uiComponents]];
|
||||
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[text]" options:0 metrics:metrics views:uiComponents]];
|
||||
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(margin)-[text]" options:0 metrics:metrics views:uiComponents]];
|
||||
|
||||
|
||||
@@ -169,9 +213,14 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
|
||||
[self.textLabel removeObserver:self forKeyPath:@"text"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
|
||||
|
||||
#pragma mark - UIActionSheetDelegate
|
||||
|
||||
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||
- (void)actionSheet:(UIActionSheet * __unused)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||
{
|
||||
UIImagePickerController * imagePickerController = [[UIImagePickerController alloc] init];
|
||||
imagePickerController.delegate = self;
|
||||
@@ -188,6 +237,8 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#pragma mark - UIImagePickerControllerDelegate
|
||||
|
||||
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// OthersFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -25,16 +25,16 @@
|
||||
|
||||
#import "MapViewController.h"
|
||||
#import "OthersFormViewController.h"
|
||||
#import "XLFormCustomCell.h"
|
||||
|
||||
NSString *const kSwitchBool = @"switchBool";
|
||||
NSString *const kSwitchCheck = @"switchBool";
|
||||
NSString *const kSwitchCheck = @"switchCheck";
|
||||
NSString *const kStepCounter = @"stepCounter";
|
||||
NSString *const kSlider = @"slider";
|
||||
NSString *const kSegmentedControl = @"segmentedControl";
|
||||
NSString *const kCustom = @"custom";
|
||||
NSString *const kInfo = @"info";
|
||||
NSString *const kButton = @"button";
|
||||
NSString *const kImage = @"image";
|
||||
NSString *const kButtonLeftAligned = @"buttonLeftAligned";
|
||||
NSString *const kButtonWithSegueId = @"buttonWithSegueId";
|
||||
NSString *const kButtonWithSegueClass = @"buttonWithSegueClass";
|
||||
@@ -45,7 +45,7 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
@implementation OthersFormViewController
|
||||
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder
|
||||
-(instancetype)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
if (self) {
|
||||
@@ -54,7 +54,7 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)init
|
||||
-(instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self){
|
||||
@@ -80,10 +80,16 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
[section addFormRow:[XLFormRowDescriptor formRowDescriptorWithTag:kSwitchCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Check"]];
|
||||
|
||||
// step counter
|
||||
[section addFormRow:[XLFormRowDescriptor formRowDescriptorWithTag:kStepCounter rowType:XLFormRowDescriptorTypeStepCounter title:@"Step counter"]];
|
||||
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:kStepCounter rowType:XLFormRowDescriptorTypeStepCounter title:@"Step counter"];
|
||||
row.value = @50;
|
||||
[row.cellConfigAtConfigure setObject:@YES forKey:@"stepControl.wraps"];
|
||||
[row.cellConfigAtConfigure setObject:@10 forKey:@"stepControl.stepValue"];
|
||||
[row.cellConfigAtConfigure setObject:@10 forKey:@"stepControl.minimumValue"];
|
||||
[row.cellConfigAtConfigure setObject:@100 forKey:@"stepControl.maximumValue"];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Segmented Control
|
||||
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:kSegmentedControl rowType:XLFormRowDescriptorTypeSelectorSegmentedControl title:@"Fruits"];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSegmentedControl rowType:XLFormRowDescriptorTypeSelectorSegmentedControl title:@"Fruits"];
|
||||
row.selectorOptions = @[@"Apple", @"Orange", @"Pear"];
|
||||
row.value = @"Pear";
|
||||
[section addFormRow:row];
|
||||
@@ -97,12 +103,11 @@ 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];
|
||||
|
||||
// Image
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kImage rowType:XLFormRowDescriptorTypeImage title:@"Image"];
|
||||
row.value = [UIImage imageNamed:@"default_avatar"];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Info cell
|
||||
XLFormRowDescriptor *infoRowDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:kInfo rowType:XLFormRowDescriptorTypeInfo];
|
||||
infoRowDescriptor.title = @"Version";
|
||||
@@ -116,22 +121,46 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
|
||||
// Button
|
||||
XLFormRowDescriptor * buttonRow = [XLFormRowDescriptor formRowDescriptorWithTag:kButton rowType:XLFormRowDescriptorTypeButton title:@"Button"];
|
||||
[buttonRow.cellConfig setObject:[UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0] forKey:@"textLabel.textColor"];
|
||||
buttonRow.action.formSelector = @selector(didTouchButton:);
|
||||
[section addFormRow:buttonRow];
|
||||
|
||||
|
||||
// Left Button
|
||||
XLFormRowDescriptor * buttonLeftAlignedRow = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonLeftAligned rowType:XLFormRowDescriptorTypeButton title:@"Button with Block"];
|
||||
[buttonLeftAlignedRow.cellConfig setObject:[UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0] forKey:@"textLabel.textColor"];
|
||||
[buttonLeftAlignedRow.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
|
||||
[buttonLeftAlignedRow.cellConfig setObject:@(NSTextAlignmentNatural) forKey:@"textLabel.textAlignment"];
|
||||
[buttonLeftAlignedRow.cellConfig setObject:@(UITableViewCellAccessoryDisclosureIndicator) forKey:@"accessoryType"];
|
||||
|
||||
__typeof(self) __weak weakSelf = self;
|
||||
buttonLeftAlignedRow.action.formBlock = ^(XLFormRowDescriptor * sender){
|
||||
if ([[sender.sectionDescriptor.formDescriptor formRowWithTag:kSwitchBool].value boolValue]){
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil) message:@"Button has checked the switch value..." delegate:self cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil)
|
||||
message:@"Button has checked the switch value..."
|
||||
delegate:weakSelf
|
||||
cancelButtonTitle:NSLocalizedString(@"OK", nil)
|
||||
otherButtonTitles:nil];
|
||||
[message show];
|
||||
#else
|
||||
if ([UIAlertController class]) {
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Switch is ON", nil)
|
||||
message:@"Button has checked the switch value..."
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:nil]];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
else{
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil)
|
||||
message:@"Button has checked the switch value..."
|
||||
delegate:weakSelf
|
||||
cancelButtonTitle:NSLocalizedString(@"OK", nil)
|
||||
otherButtonTitles:nil];
|
||||
[message show];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
[self deselectFormRow:sender];
|
||||
[weakSelf deselectFormRow:sender];
|
||||
};
|
||||
[section addFormRow:buttonLeftAlignedRow];
|
||||
|
||||
@@ -144,7 +173,7 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
|
||||
// Button with SegueId
|
||||
XLFormRowDescriptor * buttonWithSegueId = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonWithSegueClass rowType:XLFormRowDescriptorTypeButton title:@"Button with Segue Idenfifier"];
|
||||
buttonWithSegueId.action.formSegueIdenfifier = @"MapViewControllerSegue";
|
||||
buttonWithSegueId.action.formSegueIdentifier = @"MapViewControllerSegue";
|
||||
[section addFormRow:buttonWithSegueId];
|
||||
|
||||
|
||||
@@ -166,10 +195,54 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
-(void)didTouchButton:(XLFormRowDescriptor *)sender
|
||||
{
|
||||
if ([[sender.sectionDescriptor.formDescriptor formRowWithTag:kSwitchBool].value boolValue]){
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil) message:@"Button has checked the switch value..." delegate:self cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil)
|
||||
message:@"Button has checked the switch value..."
|
||||
delegate:self
|
||||
cancelButtonTitle:NSLocalizedString(@"OK", nil)
|
||||
otherButtonTitles:nil];
|
||||
[message show];
|
||||
#else
|
||||
if ([UIAlertController class]) {
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Switch is ON", nil)
|
||||
message:@"Button has checked the switch value..."
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:nil]];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
|
||||
}
|
||||
else{
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil)
|
||||
message:@"Button has checked the switch value..."
|
||||
delegate:self
|
||||
cancelButtonTitle:NSLocalizedString(@"OK", nil)
|
||||
otherButtonTitles:nil];
|
||||
[message show];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
[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
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,106 @@
|
||||
//
|
||||
// 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";
|
||||
|
||||
@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
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// 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];
|
||||
|
||||
typeof(self) __weak weakself = self;
|
||||
row.onChangeBlock = ^(id oldValue, id newValue, XLFormRowDescriptor* __unused rowDescriptor){
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Account Field changed" message:[NSString stringWithFormat:@"Old value: %@\nNew value: %@", oldValue, newValue ] preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil) style:UIAlertActionStyleCancel handler:nil]];
|
||||
[weakself.navigationController presentViewController:alert animated:YES completion:nil];
|
||||
};
|
||||
|
||||
self.form = form;
|
||||
}
|
||||
|
||||
@end
|
||||
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 120 KiB |
@@ -2,7 +2,7 @@
|
||||
// NativeEventNavigationViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -24,15 +24,11 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import "XLForm.h"
|
||||
#import "DateAndTimeValueTrasformer.h"
|
||||
#import "NativeEventFormViewController.h"
|
||||
|
||||
@implementation NativeEventNavigationViewController
|
||||
|
||||
-(id)init
|
||||
{
|
||||
self = [super initWithRootViewController:[[NativeEventFormViewController alloc] init]];
|
||||
return self;
|
||||
}
|
||||
@implementation NativeEventNavigationViewController
|
||||
|
||||
-(void)viewDidLoad
|
||||
{
|
||||
@@ -74,13 +70,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
|
||||
@@ -188,7 +184,7 @@
|
||||
if ([[rowDescriptor.value valueData] isEqualToNumber:@(0)] == NO && [[oldValue valueData] isEqualToNumber:@(0)]){
|
||||
|
||||
XLFormRowDescriptor * newRow = [rowDescriptor copy];
|
||||
[newRow setTag:@"secondAlert"];
|
||||
newRow.tag = @"secondAlert";
|
||||
newRow.title = @"Second Alert";
|
||||
[self.form addFormRow:newRow afterRow:rowDescriptor];
|
||||
}
|
||||
@@ -197,34 +193,33 @@
|
||||
}
|
||||
}
|
||||
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){
|
||||
[dateFormatter setDateStyle:NSDateFormatterFullStyle];
|
||||
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
|
||||
startDateDescriptor.valueTransformer = [DateValueTrasformer class];
|
||||
endDateDescriptor.valueTransformer = [DateValueTrasformer class];
|
||||
[dateStartCell setFormDatePickerMode:XLFormDateDatePickerModeDate];
|
||||
[dateEndCell setFormDatePickerMode:XLFormDateDatePickerModeDate];
|
||||
}
|
||||
else{
|
||||
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
|
||||
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
|
||||
startDateDescriptor.valueTransformer = [DateTimeValueTrasformer class];
|
||||
endDateDescriptor.valueTransformer = [DateTimeValueTrasformer class];
|
||||
[dateStartCell setFormDatePickerMode:XLFormDateDatePickerModeDateTime];
|
||||
[dateEndCell setFormDatePickerMode:XLFormDateDatePickerModeDateTime];
|
||||
}
|
||||
dateStartCell.dateFormatter = dateFormatter;
|
||||
dateEndCell.dateFormatter = dateFormatter;
|
||||
[dateStartCell update];
|
||||
[dateEndCell update];
|
||||
[self updateFormRow:startDateDescriptor];
|
||||
[self updateFormRow:endDateDescriptor];
|
||||
}
|
||||
else if ([rowDescriptor.tag isEqualToString:@"starts"]){
|
||||
XLFormRowDescriptor * startDateDescriptor = [self.form formRowWithTag:@"starts"];
|
||||
XLFormRowDescriptor * endDateDescriptor = [self.form formRowWithTag:@"ends"];
|
||||
XLFormDateCell * dateEndCell = (XLFormDateCell *)[endDateDescriptor cellForFormController:self];
|
||||
if ([startDateDescriptor.value compare:endDateDescriptor.value] == NSOrderedDescending) {
|
||||
// startDateDescriptor is later than endDateDescriptor
|
||||
endDateDescriptor.value = [[NSDate alloc] initWithTimeInterval:(60*60*24) sinceDate:startDateDescriptor.value];
|
||||
[dateEndCell update];
|
||||
[endDateDescriptor.cellConfig removeObjectForKey:@"detailTextLabel.attributedText"];
|
||||
[self updateFormRow:endDateDescriptor];
|
||||
}
|
||||
}
|
||||
else if ([rowDescriptor.tag isEqualToString:@"ends"]){
|
||||
@@ -233,21 +228,27 @@
|
||||
XLFormDateCell * dateEndCell = (XLFormDateCell *)[endDateDescriptor cellForFormController:self];
|
||||
if ([startDateDescriptor.value compare:endDateDescriptor.value] == NSOrderedDescending) {
|
||||
// startDateDescriptor is later than endDateDescriptor
|
||||
[dateEndCell update]; // force detailTextLabel update
|
||||
NSDictionary *strikeThroughAttribute = [NSDictionary dictionaryWithObject:@1
|
||||
forKey:NSStrikethroughStyleAttributeName];
|
||||
NSAttributedString* strikeThroughText = [[NSAttributedString alloc] initWithString:dateEndCell.detailTextLabel.text attributes:strikeThroughAttribute];
|
||||
dateEndCell.detailTextLabel.attributedText = strikeThroughText;
|
||||
[endDateDescriptor.cellConfig setObject:strikeThroughText forKey:@"detailTextLabel.attributedText"];
|
||||
[self updateFormRow:endDateDescriptor];
|
||||
}
|
||||
else{
|
||||
[endDateDescriptor.cellConfig removeObjectForKey:@"detailTextLabel.attributedText"];
|
||||
[self updateFormRow:endDateDescriptor];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(IBAction)cancelPressed:(UIBarButtonItem * __unused)button
|
||||
-(void)cancelPressed:(UIBarButtonItem * __unused)button
|
||||
{
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
||||
-(IBAction)savePressed:(UIBarButtonItem * __unused)button
|
||||
-(void)savePressed:(UIBarButtonItem * __unused)button
|
||||
{
|
||||
NSArray * validationErrors = [self formValidationErrors];
|
||||
if (validationErrors.count > 0){
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
//
|
||||
// UIFormViewCotroller+NativeEvetFormViewController.h
|
||||
// XLForm
|
||||
//
|
||||
// Created by Martin Barreto on 4/2/14.
|
||||
// Copyright (c) 2014 Xmartlabs. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
|
||||
@interface UIFormViewCotroller (NativeEventFormViewController)
|
||||
|
||||
@end
|
||||
@@ -2,7 +2,7 @@
|
||||
// CustomSelectorsFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -29,8 +29,31 @@
|
||||
NSString *const kSelectorUser = @"selectorUser";
|
||||
NSString *const kSelectorUserPopover = @"kSelectorUserPopover";
|
||||
|
||||
@implementation DynamicSelectorsFormViewController
|
||||
@interface UserTransformer : NSValueTransformer
|
||||
@end
|
||||
|
||||
@implementation UserTransformer
|
||||
|
||||
+ (Class)transformedValueClass
|
||||
{
|
||||
return [NSString class];
|
||||
}
|
||||
|
||||
+ (BOOL)allowsReverseTransformation
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (id)transformedValue:(id)value
|
||||
{
|
||||
if (!value) return nil;
|
||||
NSDictionary *user = (NSDictionary *) value;
|
||||
return [user valueForKeyPath:@"user.name"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation DynamicSelectorsFormViewController
|
||||
|
||||
-(id)init
|
||||
{
|
||||
@@ -48,19 +71,24 @@ NSString *const kSelectorUserPopover = @"kSelectorUserPopover";
|
||||
|
||||
// Selector Push
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorUser rowType:XLFormRowDescriptorTypeSelectorPush title:@"User"];
|
||||
row.action.viewControllerClass = [UsersTableViewController class];
|
||||
row.action.viewControllerStoryboardId = @"UsersTableViewController";
|
||||
row.valueTransformer = [UserTransformer class];
|
||||
[section addFormRow:row];
|
||||
|
||||
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad){
|
||||
// Selector PopOver
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorUserPopover rowType:XLFormRowDescriptorTypeSelectorPopover title:@"User Popover"];
|
||||
row.action.viewControllerClass = [UsersTableViewController class];
|
||||
[section addFormRow:row];
|
||||
}
|
||||
// if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad){
|
||||
// // Selector PopOver
|
||||
// row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorUserPopover rowType:XLFormRowDescriptorTypeSelectorPopover title:@"User Popover"];
|
||||
// row.action.viewControllerClass = [UsersTableViewController class];
|
||||
// [section addFormRow:row];
|
||||
// }
|
||||
self.form = form;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (UIStoryboard *)storyboardForRow:(XLFormRowDescriptor *)formRow
|
||||
{
|
||||
return [UIStoryboard storyboardWithName:@"iPhoneStoryboard" bundle:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// UsersTableViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -24,8 +24,11 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import "XLFormRowDescriptor.h"
|
||||
#import "XLTableViewController.h"
|
||||
#import "XLRemoteDataStoreController.h"
|
||||
|
||||
@interface UsersTableViewController : XLTableViewController <XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController>
|
||||
@interface UsersTableViewController : XLRemoteDataStoreController <XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController>
|
||||
|
||||
@end
|
||||
@property BOOL isSearchResultsController;
|
||||
@property NSLayoutConstraint *topConstraint;
|
||||
|
||||
@end
|
||||
@@ -2,7 +2,7 @@
|
||||
// UsersTableViewController.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -24,9 +24,7 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import "UsersTableViewController.h"
|
||||
#import "UserLocalDataLoader.h"
|
||||
#import "UserRemoteDataLoader.h"
|
||||
#import "User+Additions.h"
|
||||
#import "HTTPSessionManager.h"
|
||||
|
||||
// AFNetworking
|
||||
#import <AFNetworking/UIImageView+AFNetworking.h>
|
||||
@@ -65,7 +63,6 @@
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Views
|
||||
|
||||
-(UIImageView *)userImage
|
||||
@@ -101,7 +98,7 @@
|
||||
NSDictionary *metrics = @{@"imgSize":@50.0,
|
||||
@"margin" :@12.0};
|
||||
|
||||
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(margin)-[image(imgSize)]-[name]"
|
||||
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[image(imgSize)]-[name]"
|
||||
options:NSLayoutFormatAlignAllTop
|
||||
metrics:metrics
|
||||
views:views]];
|
||||
@@ -110,6 +107,7 @@
|
||||
options:0
|
||||
metrics:metrics
|
||||
views:views]];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -117,56 +115,69 @@
|
||||
@end
|
||||
|
||||
|
||||
@interface UsersTableViewController ()
|
||||
@interface UsersTableViewController () <UISearchControllerDelegate>
|
||||
|
||||
@property (nonatomic, readonly) UsersTableViewController * searchResultController;
|
||||
@property (nonatomic, readonly) UISearchController * searchController;
|
||||
|
||||
@end
|
||||
|
||||
@implementation UsersTableViewController
|
||||
|
||||
@synthesize rowDescriptor = _rowDescriptor;
|
||||
@synthesize popoverController = __popoverController;
|
||||
@synthesize searchController = _searchController;
|
||||
@synthesize searchResultController = _searchResultController;
|
||||
|
||||
static NSString *const kCellIdentifier = @"CellIdentifier";
|
||||
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
self = [super initWithCoder:coder];
|
||||
if (self) {
|
||||
// Custom initialization
|
||||
[self initialize];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initialize
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||||
{
|
||||
// Enable the pagination
|
||||
self.loadingPagingEnabled = YES;
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
if(self)
|
||||
{
|
||||
[self initialize];
|
||||
}
|
||||
|
||||
// Support Search Controller
|
||||
self.supportSearchController = YES;
|
||||
|
||||
[self setLocalDataLoader:[[UserLocalDataLoader alloc] init]];
|
||||
[self setRemoteDataLoader:[[UserRemoteDataLoader alloc] init]];
|
||||
|
||||
// Search
|
||||
[self setSearchLocalDataLoader:[[UserLocalDataLoader alloc] init]];
|
||||
[self setSearchRemoteDataLoader:[[UserRemoteDataLoader alloc] init]];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initialize
|
||||
{
|
||||
self.dataLoader = [[XLDataLoader alloc] initWithURLString:@"/mobile/users.json" offsetParamName:@"offset" limitParamName:@"limit" searchStringParamName:@"filter"];
|
||||
self.dataLoader.delegate = self;
|
||||
self.dataLoader.storeDelegate = self;
|
||||
self.dataLoader.limit = 4;
|
||||
self.dataLoader.collectionKeyPath = @"";
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
|
||||
// SearchBar
|
||||
self.tableView.tableHeaderView = self.searchDisplayController.searchBar;
|
||||
|
||||
// register cells
|
||||
[self.searchDisplayController.searchResultsTableView registerClass:[UserCell class] forCellReuseIdentifier:kCellIdentifier];
|
||||
[self.tableView registerClass:[UserCell class] forCellReuseIdentifier:kCellIdentifier];
|
||||
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
|
||||
[self customizeAppearance];
|
||||
if (!self.isSearchResultsController){
|
||||
self.tableView.tableHeaderView = self.searchController.searchBar;
|
||||
}
|
||||
else{
|
||||
[self.tableView setContentInset:UIEdgeInsetsMake(64, 0, 0, 0)];
|
||||
[self.tableView setScrollIndicatorInsets:self.tableView.contentInset];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
[self.searchController.searchBar sizeToFit];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDataSource
|
||||
@@ -174,49 +185,28 @@ static NSString *const kCellIdentifier = @"CellIdentifier";
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UserCell *cell = (UserCell *) [tableView dequeueReusableCellWithIdentifier:kCellIdentifier forIndexPath:indexPath];;
|
||||
|
||||
User * user = nil;
|
||||
if (tableView == self.tableView){
|
||||
user = (User *)[self.localDataLoader objectAtIndexPath:indexPath];
|
||||
}
|
||||
else{
|
||||
user = (User *)[self.searchLocalDataLoader objectAtIndexPath:indexPath];
|
||||
}
|
||||
NSDictionary *dataItem = [self.dataStore dataAtIndexPath:indexPath];
|
||||
|
||||
cell.userName.text = [dataItem valueForKeyPath:@"user.name"];
|
||||
[cell.userImage setImageWithURL:[NSURL URLWithString:[dataItem valueForKeyPath:@"user.imageURL"]] placeholderImage:[UIImage imageNamed:@"default-avatar"]];
|
||||
|
||||
cell.accessoryType = [[self.rowDescriptor.value valueForKeyPath:@"user.id"] isEqual:[dataItem valueForKeyPath:@"user.id"]] ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
|
||||
|
||||
cell.userName.text = user.userName;
|
||||
NSMutableURLRequest* imageRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:user.userImageURL]];
|
||||
[imageRequest setValue:@"image/*" forHTTPHeaderField:@"Accept"];
|
||||
__typeof__(cell) __weak weakCell = cell;
|
||||
[cell.userImage setImageWithURLRequest: imageRequest
|
||||
placeholderImage:[User defaultProfileImage]
|
||||
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
|
||||
if (image) {
|
||||
[weakCell.userImage setImage:image];
|
||||
}
|
||||
}
|
||||
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {
|
||||
}];
|
||||
cell.accessoryType = [[self.rowDescriptor.value formValue] isEqual:user.userId] ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate
|
||||
|
||||
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
return 73.0f;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UITableViewDelegate
|
||||
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
User * user = nil;
|
||||
if (tableView == self.tableView){
|
||||
user = (User *)[self.localDataLoader objectAtIndexPath:indexPath];
|
||||
}
|
||||
else{
|
||||
user = (User *)[self.searchLocalDataLoader objectAtIndexPath:indexPath];
|
||||
}
|
||||
self.rowDescriptor.value = user;
|
||||
NSDictionary *dataItem = [self.dataStore dataAtIndexPath:indexPath];
|
||||
|
||||
self.rowDescriptor.value = dataItem;
|
||||
|
||||
if (self.popoverController){
|
||||
[self.popoverController dismissPopoverAnimated:YES];
|
||||
@@ -227,19 +217,36 @@ static NSString *const kCellIdentifier = @"CellIdentifier";
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XLDataLoaderDelegate
|
||||
|
||||
#pragma mark - Helpers
|
||||
|
||||
-(void)customizeAppearance
|
||||
-(AFHTTPSessionManager *)sessionManagerForDataLoader:(XLDataLoader *)dataLoader
|
||||
{
|
||||
[[self navigationItem] setTitle:@"Select a User"];
|
||||
return [HTTPSessionManager sharedClient];
|
||||
}
|
||||
|
||||
#pragma mark - UISearchController
|
||||
|
||||
-(UISearchController *)searchController
|
||||
{
|
||||
if (_searchController) return _searchController;
|
||||
|
||||
[self.tableView setBackgroundColor:[UIColor colorWithWhite:0.9 alpha:1.0]];
|
||||
[self.tableView setTableFooterView:[[UIView alloc] initWithFrame:CGRectZero]];
|
||||
|
||||
[self.searchDisplayController.searchResultsTableView setBackgroundColor:[UIColor colorWithWhite:0.9 alpha:1.0]];
|
||||
[self.searchDisplayController.searchResultsTableView setTableFooterView:[[UIView alloc] initWithFrame:CGRectZero]];
|
||||
self.definesPresentationContext = YES;
|
||||
_searchController = [[UISearchController alloc] initWithSearchResultsController:self.searchResultController];
|
||||
_searchController.delegate = self;
|
||||
_searchController.searchResultsUpdater = self.searchResultController;
|
||||
_searchController.searchBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||
[_searchController.searchBar sizeToFit];
|
||||
return _searchController;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
-(UsersTableViewController *)searchResultController
|
||||
{
|
||||
if (_searchResultController) return _searchResultController;
|
||||
_searchResultController = [[UsersTableViewController alloc]init];
|
||||
_searchResultController.dataLoader.limit = 0; // no paging in search result
|
||||
_searchResultController.isSearchResultsController = YES;
|
||||
return _searchResultController;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -2,7 +2,7 @@
|
||||
// HTTPSessionManager.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -317,34 +317,6 @@ NSString *const kSelectorWithStoryboardId = @"selectorWithStoryboardId";
|
||||
row.action.viewControllerClass = [CustomSelectorsFormViewController class];
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Disabled & Required Selectors"];
|
||||
[form addFormSection:section];
|
||||
|
||||
|
||||
|
||||
// Disabled Selector Push
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorPushDisabled rowType:XLFormRowDescriptorTypeSelectorPush title:@"Push"];
|
||||
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"];
|
||||
row.disabled = YES;
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
|
||||
// --------- Disabled Selector Action Sheet
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorActionSheetDisabled rowType:XLFormRowDescriptorTypeSelectorActionSheet title:@"Sheet"];
|
||||
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"];
|
||||
row.disabled = YES;
|
||||
[section addFormRow:row];
|
||||
|
||||
// --------- Disabled Selector Left Right
|
||||
|
||||
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;
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
// --------- Selector definition types
|
||||
|
||||
@@ -360,8 +332,8 @@ NSString *const kSelectorWithStoryboardId = @"selectorWithStoryboardId";
|
||||
[section addFormRow:row];
|
||||
|
||||
// selector with SegueId
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorWithSegueClass rowType:XLFormRowDescriptorTypeSelectorPush title:@"Selector with Segue Idenfifier"];
|
||||
row.action.formSegueIdenfifier = @"MapViewControllerSegue";
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorWithSegueId rowType:XLFormRowDescriptorTypeSelectorPush title:@"Selector with Segue Identifier"];
|
||||
row.action.formSegueIdentifier = @"MapViewControllerSegue";
|
||||
row.valueTransformer = [CLLocationValueTrasformer class];
|
||||
row.value = [[CLLocation alloc] initWithLatitude:-33 longitude:-56];
|
||||
[section addFormRow:row];
|
||||
@@ -392,4 +364,24 @@ 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="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="p4n-1v-pzo">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="p4n-1v-pzo">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Navigation Controller-->
|
||||
@@ -13,6 +13,7 @@
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="SNt-hk-N3V">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
<connections>
|
||||
@@ -32,10 +33,12 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="HPb-Nx-E1G"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="wpr-wE-9nj">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
|
||||
<navigationItem key="navigationItem" id="Hf0-cB-ORN"/>
|
||||
<connections>
|
||||
<segue destination="WMh-VN-FWi" kind="push" identifier="MapViewControllerSegue" id="wAD-tS-AFZ"/>
|
||||
@@ -59,9 +62,11 @@
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="JY7-WL-SnH">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="JY7-WL-SnH" firstAttribute="leading" secondItem="tun-QW-CGC" secondAttribute="leading" id="bSe-SV-rx6"/>
|
||||
@@ -93,9 +98,11 @@
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="Lxj-Sb-kC6">
|
||||
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Lxj-Sb-kC6" firstAttribute="top" secondItem="kOR-67-djF" secondAttribute="bottom" id="PT1-Xo-3Ql"/>
|
||||
@@ -111,12 +118,36 @@
|
||||
<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="64" width="320" height="504"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
|
||||
<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>
|
||||
@@ -131,9 +162,11 @@
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="Fty-3j-BeF">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="xtJ-Wo-mhU" firstAttribute="top" secondItem="Fty-3j-BeF" secondAttribute="bottom" id="CbV-4f-RzP"/>
|
||||
@@ -151,7 +184,28 @@
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="VFT-Og-STO" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="527" y="789"/>
|
||||
<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="64" width="320" height="504"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
|
||||
<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"/>
|
||||
</scene>
|
||||
<!--Selectors Form View Controller-->
|
||||
<scene sceneID="KYK-TX-8rm">
|
||||
@@ -162,10 +216,12 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="CTu-Y5-7Qw"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="bNj-SD-83w">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
|
||||
<navigationItem key="navigationItem" id="Buo-Af-6Q1"/>
|
||||
<connections>
|
||||
<segue destination="WMh-VN-FWi" kind="push" identifier="MapViewControllerSegue" id="Mtw-x2-E0b"/>
|
||||
@@ -184,10 +240,12 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="cgQ-Vs-ICN"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="JjC-E5-SyY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
|
||||
<navigationItem key="navigationItem" id="BjG-Bq-0lD"/>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="LmS-YR-mFY" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
@@ -202,6 +260,7 @@
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="fO3-V7-XXu">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
<connections>
|
||||
@@ -210,15 +269,67 @@
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="eqB-vl-BzH" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="588" y="-635"/>
|
||||
<point key="canvasLocation" x="586" y="-654"/>
|
||||
</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="64" width="320" height="504"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
|
||||
<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>
|
||||
<!--Users Table View Controller-->
|
||||
<scene sceneID="lGi-0L-kUk">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="UsersTableViewController" automaticallyAdjustsScrollViewInsets="NO" definesPresentationContext="YES" modalPresentationStyle="currentContext" id="MON-q2-1DB" customClass="UsersTableViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="at2-Ds-EcY"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="uVG-bI-IMr"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="sMH-hT-NCg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView autoresizesSubviews="NO" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="fLo-Gu-rqr">
|
||||
<rect key="frame" x="0.0" y="20" width="320" height="548"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="uVG-bI-IMr" firstAttribute="top" secondItem="fLo-Gu-rqr" secondAttribute="bottom" id="25A-HG-wek"/>
|
||||
<constraint firstItem="fLo-Gu-rqr" firstAttribute="top" secondItem="at2-Ds-EcY" secondAttribute="bottom" id="3N4-a2-LLf"/>
|
||||
<constraint firstAttribute="trailing" secondItem="fLo-Gu-rqr" secondAttribute="trailing" id="IXV-p6-sAw"/>
|
||||
<constraint firstItem="fLo-Gu-rqr" firstAttribute="leading" secondItem="sMH-hT-NCg" secondAttribute="leading" id="Xjr-w6-wlu"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="LIq-iZ-ILx"/>
|
||||
<connections>
|
||||
<outlet property="tableView" destination="fLo-Gu-rqr" id="2ES-0n-eVG"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="flB-2M-8zS" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1346" y="1178"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<simulatedStatusBarMetrics key="statusBar"/>
|
||||
<simulatedOrientationMetrics key="orientation"/>
|
||||
<simulatedScreenMetrics key="destination" type="retina4"/>
|
||||
</simulatedMetricsContainer>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="wAD-tS-AFZ"/>
|
||||
<segue reference="Mtw-x2-E0b"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
</document>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// UICustomizationFormViewController.h
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 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) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -26,10 +26,6 @@
|
||||
#import "XLForm.h"
|
||||
#import "ValidationExamplesFormViewController.h"
|
||||
|
||||
@interface ValidationExamplesFormViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation ValidationExamplesFormViewController
|
||||
|
||||
NSString * const kValidationName = @"kName";
|
||||
@@ -93,7 +89,7 @@ NSString * const kValidationInteger = @"kInteger";
|
||||
|
||||
// number Section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Validation Numbers"];
|
||||
section.footerTitle = @"grather than 50 and less than 100";
|
||||
section.footerTitle = @"greater than 50 and less than 100";
|
||||
[formDescriptor addFormSection:section];
|
||||
|
||||
// Integer
|
||||
@@ -101,7 +97,7 @@ NSString * const kValidationInteger = @"kInteger";
|
||||
[row.cellConfigAtConfigure setObject:@"Required..." forKey:@"textField.placeholder"];
|
||||
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"];
|
||||
row.required = YES;
|
||||
[row addValidator:[XLFormRegexValidator formRegexValidatorWithMsg:@"grather than 50 and less than 100" regex:@"^([5-9][0-9]|100)$"]];
|
||||
[row addValidator:[XLFormRegexValidator formRegexValidatorWithMsg:@"greater than 50 and less than 100" regex:@"^([5-9][0-9]|100)$"]];
|
||||
[section addFormRow:row];
|
||||
|
||||
self.form = formDescriptor;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
platform :ios, '7.0'
|
||||
platform :ios, '8.0'
|
||||
|
||||
pod 'XLForm', :path => '../../'
|
||||
|
||||
#Following pods are used for custom row examples
|
||||
pod 'AFNetworking', '~> 2.0', :inhibit_warnings => true
|
||||
pod 'XLDataLoader', '~> 1.1', :inhibit_warnings => true
|
||||
pod 'XLData', :git => 'https://github.com/xmartlabs/XLData.git', :commit => '1f9019b56242a2019c7f7e11ec4ef823c397ebcf', :inhibit_warnings => true
|
||||
pod 'JVFloatLabeledTextField', '1.0.2', :inhibit_warnings => true
|
||||
pod 'AXRatingView', '1.0.3', :inhibit_warnings => true
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
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
|
||||
@@ -27,13 +27,6 @@
|
||||
28815E2E1A8589F600B674D2 /* MapViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28815E2D1A8589F600B674D2 /* MapViewController.xib */; };
|
||||
28A7661F193248BD00D69546 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28A7661E193248BD00D69546 /* CoreData.framework */; };
|
||||
28A76625193251E500D69546 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A76624193251E500D69546 /* AppDelegate.m */; };
|
||||
28A7662E1932E98A00D69546 /* HTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A7662D1932E98A00D69546 /* HTTPSessionManager.m */; };
|
||||
28A7663B1932EA1F00D69546 /* UserLocalDataLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A766361932EA1F00D69546 /* UserLocalDataLoader.m */; };
|
||||
28A7663C1932EA1F00D69546 /* UserRemoteDataLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A766381932EA1F00D69546 /* UserRemoteDataLoader.m */; };
|
||||
28A766451932EC9C00D69546 /* CoreDataStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A766401932EC9C00D69546 /* CoreDataStore.m */; };
|
||||
28A766461932EC9C00D69546 /* User+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A766421932EC9C00D69546 /* User+Additions.m */; };
|
||||
28A7664A1932ED3400D69546 /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 28A766481932ED3400D69546 /* Model.xcdatamodeld */; };
|
||||
28A7664D1932EE0B00D69546 /* User.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A7664C1932EE0B00D69546 /* User.m */; };
|
||||
28A766551932F22400D69546 /* UsersTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A766541932F22400D69546 /* UsersTableViewController.m */; };
|
||||
28A7665E1932F61100D69546 /* DynamicSelectorsFormViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A7665D1932F61100D69546 /* DynamicSelectorsFormViewController.m */; };
|
||||
28A8083E190D9083009D77F8 /* iPhoneStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28A8083D190D9083009D77F8 /* iPhoneStoryboard.storyboard */; };
|
||||
@@ -43,20 +36,25 @@
|
||||
2CA9A3FC06E94345A2FDE415 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F6DF43B7BBF44F72A4493E8E /* libPods.a */; };
|
||||
3C0357F01AB0D82300200C8A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3C0357EF1AB0D82300200C8A /* Images.xcassets */; };
|
||||
3C3B01D51AB741EF0027CD45 /* XLFormRatingCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3B01D31AB741EF0027CD45 /* XLFormRatingCell.m */; };
|
||||
3C3B01D61AB741EF0027CD45 /* XLFormRatingCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C3B01D41AB741EF0027CD45 /* XLFormRatingCell.xib */; };
|
||||
3C3B01DA1AB7497D0027CD45 /* XLFormWeekDaysCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3B01D81AB7497D0027CD45 /* XLFormWeekDaysCell.m */; };
|
||||
3C3B01DB1AB7497D0027CD45 /* XLFormWeekDaysCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C3B01D91AB7497D0027CD45 /* XLFormWeekDaysCell.xib */; };
|
||||
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 */; };
|
||||
BFA5F4B11BB48F8E00D045BD /* XLFormRatingCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C3B01D41AB741EF0027CD45 /* XLFormRatingCell.xib */; };
|
||||
BFE91AFB1AE159B200DE5231 /* BasicPredicateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BFE91AFA1AE159B200DE5231 /* BasicPredicateViewController.m */; };
|
||||
D51B8B2C19126664008C0478 /* XLFormCustomCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D51B8B2B19126664008C0478 /* XLFormCustomCell.m */; };
|
||||
DEA6EF911B57D6CC000F4893 /* HTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DEA6EF901B57D6CC000F4893 /* HTTPSessionManager.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 = 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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
@@ -88,19 +86,6 @@
|
||||
28815E2D1A8589F600B674D2 /* MapViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = MapViewController.xib; path = Examples/Selectors/CustomSelectors/XLFormRowViewController/MapViewController.xib; sourceTree = "<group>"; };
|
||||
28A7661E193248BD00D69546 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
|
||||
28A76624193251E500D69546 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Examples/AppDelegate.m; sourceTree = "<group>"; };
|
||||
28A7662C1932E98A00D69546 /* HTTPSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPSessionManager.h; path = Examples/Selectors/Helpers/HTTPSessionManager.h; sourceTree = "<group>"; };
|
||||
28A7662D1932E98A00D69546 /* HTTPSessionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HTTPSessionManager.m; path = Examples/Selectors/Helpers/HTTPSessionManager.m; sourceTree = "<group>"; };
|
||||
28A766351932EA1F00D69546 /* UserLocalDataLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserLocalDataLoader.h; sourceTree = "<group>"; };
|
||||
28A766361932EA1F00D69546 /* UserLocalDataLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserLocalDataLoader.m; sourceTree = "<group>"; };
|
||||
28A766371932EA1F00D69546 /* UserRemoteDataLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserRemoteDataLoader.h; sourceTree = "<group>"; };
|
||||
28A766381932EA1F00D69546 /* UserRemoteDataLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserRemoteDataLoader.m; sourceTree = "<group>"; };
|
||||
28A7663F1932EC9C00D69546 /* CoreDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreDataStore.h; sourceTree = "<group>"; };
|
||||
28A766401932EC9C00D69546 /* CoreDataStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CoreDataStore.m; sourceTree = "<group>"; };
|
||||
28A766411932EC9C00D69546 /* User+Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "User+Additions.h"; sourceTree = "<group>"; };
|
||||
28A766421932EC9C00D69546 /* User+Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "User+Additions.m"; sourceTree = "<group>"; };
|
||||
28A766491932ED3400D69546 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; };
|
||||
28A7664B1932EE0B00D69546 /* User.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = User.h; sourceTree = "<group>"; };
|
||||
28A7664C1932EE0B00D69546 /* User.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = User.m; sourceTree = "<group>"; };
|
||||
28A766531932F22400D69546 /* UsersTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UsersTableViewController.h; path = Examples/Selectors/DynamicSelector/UsersTableViewController.h; sourceTree = "<group>"; };
|
||||
28A766541932F22400D69546 /* UsersTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UsersTableViewController.m; path = Examples/Selectors/DynamicSelector/UsersTableViewController.m; sourceTree = "<group>"; };
|
||||
28A7665C1932F61100D69546 /* DynamicSelectorsFormViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DynamicSelectorsFormViewController.h; path = Examples/Selectors/DynamicSelector/DynamicSelectorsFormViewController.h; sourceTree = "<group>"; };
|
||||
@@ -125,10 +110,20 @@
|
||||
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>"; };
|
||||
DEA6EF8F1B57D6CC000F4893 /* HTTPSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPSessionManager.h; path = Examples/Selectors/HTTPSessionManager.h; sourceTree = "<group>"; };
|
||||
DEA6EF901B57D6CC000F4893 /* HTTPSessionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HTTPSessionManager.m; path = Examples/Selectors/HTTPSessionManager.m; sourceTree = "<group>"; };
|
||||
F6DF43B7BBF44F72A4493E8E /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@@ -211,7 +206,6 @@
|
||||
children = (
|
||||
283B59AF19531DDA000828CD /* CustomSelectors */,
|
||||
28A766521932F1FA00D69546 /* DynamicSelector */,
|
||||
28A7662B1932E92D00D69546 /* Helpers */,
|
||||
2843EB4918D496F600F13E2B /* SelectorsFormViewController.h */,
|
||||
2843EB4A18D496F600F13E2B /* SelectorsFormViewController.m */,
|
||||
);
|
||||
@@ -231,6 +225,8 @@
|
||||
2843EB5318D4F77F00F13E2B /* Dates */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
66B6266C1AE0055100007886 /* DateAndTimeValueTrasformer.h */,
|
||||
66B6266D1AE0055100007886 /* DateAndTimeValueTrasformer.m */,
|
||||
2843EB5418D4F7B700F13E2B /* DatesFormViewController.h */,
|
||||
2843EB5518D4F7B700F13E2B /* DatesFormViewController.m */,
|
||||
);
|
||||
@@ -322,6 +318,7 @@
|
||||
2843EB4F18D4CFA100F13E2B /* Others */,
|
||||
2843EB4818D496CB00F13E2B /* Selectors */,
|
||||
2850C60A18D0F706002B7D0A /* AppDelegate.h */,
|
||||
BFD5D6F41AD2FFC1006F04FA /* PredicateExamples */,
|
||||
282C5EEF18D33C1800A5D47C /* Inputs */,
|
||||
2843EB4518D4915800F13E2B /* ExamplesFormViewController.h */,
|
||||
2843EB4618D4915800F13E2B /* ExamplesFormViewController.m */,
|
||||
@@ -340,55 +337,10 @@
|
||||
name = CustomCells;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
28A7662B1932E92D00D69546 /* Helpers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
28A7663D1932EC9C00D69546 /* Data */,
|
||||
28A766301932EA1F00D69546 /* DataLoaders */,
|
||||
28A7662C1932E98A00D69546 /* HTTPSessionManager.h */,
|
||||
28A7662D1932E98A00D69546 /* HTTPSessionManager.m */,
|
||||
);
|
||||
name = Helpers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
28A766301932EA1F00D69546 /* DataLoaders */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
28A766351932EA1F00D69546 /* UserLocalDataLoader.h */,
|
||||
28A766361932EA1F00D69546 /* UserLocalDataLoader.m */,
|
||||
28A766371932EA1F00D69546 /* UserRemoteDataLoader.h */,
|
||||
28A766381932EA1F00D69546 /* UserRemoteDataLoader.m */,
|
||||
);
|
||||
name = DataLoaders;
|
||||
path = Examples/Selectors/Helpers/DataLoaders;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
28A7663D1932EC9C00D69546 /* Data */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
28A7663E1932EC9C00D69546 /* Store */,
|
||||
28A766411932EC9C00D69546 /* User+Additions.h */,
|
||||
28A766421932EC9C00D69546 /* User+Additions.m */,
|
||||
28A766481932ED3400D69546 /* Model.xcdatamodeld */,
|
||||
28A7664B1932EE0B00D69546 /* User.h */,
|
||||
28A7664C1932EE0B00D69546 /* User.m */,
|
||||
);
|
||||
name = Data;
|
||||
path = Examples/Selectors/Helpers/Data;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
28A7663E1932EC9C00D69546 /* Store */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
28A7663F1932EC9C00D69546 /* CoreDataStore.h */,
|
||||
28A766401932EC9C00D69546 /* CoreDataStore.m */,
|
||||
);
|
||||
path = Store;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
28A766521932F1FA00D69546 /* DynamicSelector */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DEA6EF8E1B57D698000F4893 /* SessionManager */,
|
||||
28A7665A1932F55700D69546 /* XLFormRowViewController */,
|
||||
28A7665C1932F61100D69546 /* DynamicSelectorsFormViewController.h */,
|
||||
28A7665D1932F61100D69546 /* DynamicSelectorsFormViewController.m */,
|
||||
@@ -473,6 +425,29 @@
|
||||
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>";
|
||||
};
|
||||
DEA6EF8E1B57D698000F4893 /* SessionManager */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DEA6EF8F1B57D6CC000F4893 /* HTTPSessionManager.h */,
|
||||
DEA6EF901B57D6CC000F4893 /* HTTPSessionManager.m */,
|
||||
);
|
||||
name = SessionManager;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -485,6 +460,7 @@
|
||||
2850C5F518D0F706002B7D0A /* Frameworks */,
|
||||
2850C5F618D0F706002B7D0A /* Resources */,
|
||||
CFE72E068B5F4D9BB45FB757 /* Copy Pods Resources */,
|
||||
734CC62A7A974D37CC982576 /* Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -501,7 +477,7 @@
|
||||
2850C5F018D0F706002B7D0A /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0510;
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = Xmartlabs;
|
||||
};
|
||||
buildConfigurationList = 2850C5F318D0F706002B7D0A /* Build configuration list for PBXProject "XLForm" */;
|
||||
@@ -528,10 +504,10 @@
|
||||
files = (
|
||||
28468EA718EF594900DBB015 /* Localizable.strings in Resources */,
|
||||
2850C60618D0F706002B7D0A /* InfoPlist.strings in Resources */,
|
||||
BFA5F4B11BB48F8E00D045BD /* XLFormRatingCell.xib in Resources */,
|
||||
28815E2E1A8589F600B674D2 /* MapViewController.xib in Resources */,
|
||||
3C0357F01AB0D82300200C8A /* Images.xcassets in Resources */,
|
||||
3C3B01DB1AB7497D0027CD45 /* XLFormWeekDaysCell.xib in Resources */,
|
||||
3C3B01D61AB741EF0027CD45 /* XLFormRatingCell.xib in Resources */,
|
||||
28A8083E190D9083009D77F8 /* iPhoneStoryboard.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -554,6 +530,21 @@
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
734CC62A7A974D37CC982576 /* Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
CFE72E068B5F4D9BB45FB757 /* Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -579,30 +570,28 @@
|
||||
283B59B7195334AF000828CD /* CustomSelectorsFormViewController.m in Sources */,
|
||||
28A766551932F22400D69546 /* UsersTableViewController.m in Sources */,
|
||||
3CDAFC7A1AB0AFA4000F75B6 /* CustomRowsViewController.m in Sources */,
|
||||
28A7663B1932EA1F00D69546 /* UserLocalDataLoader.m in Sources */,
|
||||
DEA6EF911B57D6CC000F4893 /* HTTPSessionManager.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 */,
|
||||
28A7664A1932ED3400D69546 /* Model.xcdatamodeld in Sources */,
|
||||
3C3B01F01AB74BDC0027CD45 /* FloatLabeledTextFieldCell.m in Sources */,
|
||||
28A766461932EC9C00D69546 /* User+Additions.m in Sources */,
|
||||
28DBB04118D76FDC00FB8A8B /* MultivaluedFormViewController.m in Sources */,
|
||||
28A85D5918E346C100E81A26 /* XLFormImageSelectorCell.m in Sources */,
|
||||
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 */,
|
||||
2843EB5618D4F7B700F13E2B /* DatesFormViewController.m in Sources */,
|
||||
283C6B7D1999BAF100A5283D /* UICustomizationFormViewController.m in Sources */,
|
||||
3C3B01E21AB7499A0027CD45 /* XLRatingView.m in Sources */,
|
||||
28A7662E1932E98A00D69546 /* HTTPSessionManager.m in Sources */,
|
||||
283B59B219532415000828CD /* MapViewController.m in Sources */,
|
||||
2843EB4718D4915800F13E2B /* ExamplesFormViewController.m in Sources */,
|
||||
28A766451932EC9C00D69546 /* CoreDataStore.m in Sources */,
|
||||
28A7663C1932EA1F00D69546 /* UserRemoteDataLoader.m in Sources */,
|
||||
BF9DB1D61AE0436600B985E7 /* PredicateFormViewController.m in Sources */,
|
||||
BFE91AFB1AE159B200DE5231 /* BasicPredicateViewController.m in Sources */,
|
||||
2843EB5218D4CFC700F13E2B /* OthersFormViewController.m in Sources */,
|
||||
2843EB4B18D496F600F13E2B /* SelectorsFormViewController.m in Sources */,
|
||||
28468EA418EF41D300DBB015 /* InputsFormViewController.m in Sources */,
|
||||
@@ -650,6 +639,7 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
@@ -664,7 +654,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
@@ -696,7 +686,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
@@ -711,7 +701,8 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "XLForm/XLForm-Prefix.pch";
|
||||
INFOPLIST_FILE = "XLForm/XLForm-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
WRAPPER_EXTENSION = app;
|
||||
@@ -727,7 +718,8 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "XLForm/XLForm-Prefix.pch";
|
||||
INFOPLIST_FILE = "XLForm/XLForm-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
WRAPPER_EXTENSION = app;
|
||||
@@ -756,19 +748,6 @@
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCVersionGroup section */
|
||||
28A766481932ED3400D69546 /* Model.xcdatamodeld */ = {
|
||||
isa = XCVersionGroup;
|
||||
children = (
|
||||
28A766491932ED3400D69546 /* Model.xcdatamodel */,
|
||||
);
|
||||
currentVersion = 28A766491932ED3400D69546 /* Model.xcdatamodel */;
|
||||
path = Model.xcdatamodeld;
|
||||
sourceTree = "<group>";
|
||||
versionGroupType = wrapper.xcdatamodel;
|
||||
};
|
||||
/* End XCVersionGroup section */
|
||||
};
|
||||
rootObject = 2850C5F018D0F706002B7D0A /* Project object */;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,40 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "xl_appicon_58.png",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "xl_appicon_80.png",
|
||||
"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",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
@@ -22,6 +47,117 @@
|
||||
"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" : {
|
||||
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 823 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 883 B |
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -2,6 +2,11 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
@@ -9,7 +14,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
@@ -17,11 +22,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0.1</string>
|
||||
<string>3.0.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.0.1</string>
|
||||
<string>3.0.1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
XLForm
|
||||
|
||||
Created by Martin Barreto on 4/4/14.
|
||||
Copyright (c) 2014 Xmartlabs. All rights reserved.
|
||||
Copyright (c) 2015 Xmartlabs. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// main.m
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs. All rights reserved.
|
||||
// Copyright (c) 2015 Xmartlabs. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@@ -0,0 +1,250 @@
|
||||
//
|
||||
// AccessoryViewFormViewController.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 "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
|
||||
}
|
||||
|
||||
|
||||
NSString * kAccessoryViewRowNavigationEnabled = @"kRowNavigationEnabled";
|
||||
NSString * kAccessoryViewRowNavigationShowAccessoryView = @"kRowNavigationShowAccessoryView";
|
||||
NSString * kAccessoryViewRowNavigationStopDisableRow = @"rowNavigationStopDisableRow";
|
||||
NSString * kAccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow = @"rowNavigationSkipCanNotBecomeFirstResponderRow";
|
||||
NSString * kAccessoryViewRowNavigationStopInlineRow = @"rowNavigationStopInlineRow";
|
||||
NSString * kAccessoryViewName = @"name";
|
||||
NSString * kAccessoryViewEmail = @"email";
|
||||
NSString * kAccessoryViewTwitter = @"twitter";
|
||||
NSString * kAccessoryViewUrl = @"url";
|
||||
NSString * kAccessoryViewDate = @"date";
|
||||
NSString * kAccessoryViewTextView = @"textView";
|
||||
NSString * kAccessoryViewCheck = @"check";
|
||||
NSString * kAccessoryViewNotes = @"notes";
|
||||
|
||||
|
||||
|
||||
|
||||
-(id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self initializeForm];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initializeForm
|
||||
{
|
||||
XLFormDescriptor * formDescriptor = [XLFormDescriptor formDescriptorWithTitle:@"Accessory View"];
|
||||
formDescriptor.rowNavigationOptions = XLFormRowNavigationOptionEnabled;
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
XLFormRowDescriptor * switchRow;
|
||||
|
||||
// Configuration section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Row Navigation Settings"];
|
||||
section.footerTitle = @"Changing the Settings values you will navigate differently";
|
||||
[formDescriptor addFormSection:section];
|
||||
|
||||
// RowNavigationEnabled
|
||||
switchRow = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationEnabled rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Row Navigation Enabled?"];
|
||||
switchRow.value = @YES;
|
||||
[section addFormRow:switchRow];
|
||||
|
||||
// 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
|
||||
|
||||
// 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
|
||||
|
||||
// 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
|
||||
|
||||
// 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
|
||||
|
||||
|
||||
|
||||
// Basic Information - Section
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"TextField Types"];
|
||||
section.footerTitle = @"This is a long text that will appear on section footer";
|
||||
[formDescriptor addFormSection:section];
|
||||
|
||||
// Name
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewName rowType:XLFormRowDescriptorTypeText title:@"Name"];
|
||||
row.required = YES;
|
||||
[section addFormRow:row];
|
||||
|
||||
// Email
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewEmail rowType:XLFormRowDescriptorTypeEmail title:@"Email"];
|
||||
// validate the email
|
||||
[row addValidator:[XLFormValidator emailValidator]];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Twitter
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewTwitter rowType:XLFormRowDescriptorTypeTwitter title:@"Twitter"];
|
||||
row.disabled = @YES;
|
||||
row.value = @"@no_editable";
|
||||
[section addFormRow:row];
|
||||
|
||||
// Url
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewUrl rowType:XLFormRowDescriptorTypeURL title:@"Url"];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Url
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewDate rowType:XLFormRowDescriptorTypeDateInline title:@"Date Inline"];
|
||||
row.value = [NSDate new];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[formDescriptor addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewTextView rowType:XLFormRowDescriptorTypeTextView];
|
||||
[row.cellConfigAtConfigure setObject:@"TEXT VIEW EXAMPLE" forKey:@"textView.placeholder"];
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Check"];
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"TextView With Label Example"];
|
||||
[formDescriptor addFormSection:section];
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewNotes rowType:XLFormRowDescriptorTypeTextView title:@"Notes"];
|
||||
[section addFormRow:row];
|
||||
|
||||
self.form = formDescriptor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - XLFormDescriptorDelegate
|
||||
|
||||
-(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]){
|
||||
self.form.rowNavigationOptions = XLFormRowNavigationOptionNone;
|
||||
[self.form removeFormRowWithTag:kAccessoryViewRowNavigationShowAccessoryView];
|
||||
[self.form removeFormRowWithTag:kAccessoryViewRowNavigationStopDisableRow];
|
||||
[self.form removeFormRowWithTag:kAccessoryViewRowNavigationStopInlineRow];
|
||||
[self.form removeFormRowWithTag:kAccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow];
|
||||
}
|
||||
else{
|
||||
self.form.rowNavigationOptions = XLFormRowNavigationOptionEnabled;
|
||||
_rowShowAccessoryView.value = @YES;
|
||||
_rowStopDisableRow.value = @NO;
|
||||
_rowStopInlineRow.value = @NO;
|
||||
_rowSkipCanNotBecomeFirstResponderRow.value = @NO;
|
||||
[self.form addFormRow:_rowShowAccessoryView afterRow:rowDescriptor];
|
||||
[self.form addFormRow:_rowStopDisableRow afterRow:_rowShowAccessoryView];
|
||||
[self.form addFormRow:_rowStopInlineRow afterRow:_rowStopDisableRow];
|
||||
[self.form addFormRow:_rowSkipCanNotBecomeFirstResponderRow afterRow:_rowStopInlineRow];
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ([rowDescriptor.tag isEqualToString:kAccessoryViewRowNavigationStopDisableRow]){
|
||||
if ([[rowDescriptor.value valueData] isEqual:@(YES)]){
|
||||
self.form.rowNavigationOptions = self.form.rowNavigationOptions | XLFormRowNavigationOptionStopDisableRow;
|
||||
}
|
||||
else{
|
||||
self.form.rowNavigationOptions = self.form.rowNavigationOptions & (~XLFormRowNavigationOptionStopDisableRow);
|
||||
}
|
||||
}
|
||||
else if ([rowDescriptor.tag isEqualToString:kAccessoryViewRowNavigationStopInlineRow]){
|
||||
if ([[rowDescriptor.value valueData] isEqual:@(YES)]){
|
||||
self.form.rowNavigationOptions = self.form.rowNavigationOptions | XLFormRowNavigationOptionStopInlineRow;
|
||||
}
|
||||
else{
|
||||
self.form.rowNavigationOptions = self.form.rowNavigationOptions & (~XLFormRowNavigationOptionStopInlineRow);
|
||||
}
|
||||
}
|
||||
else if ([rowDescriptor.tag isEqualToString:kAccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow]){
|
||||
if ([[rowDescriptor.value valueData] isEqual:@(YES)]){
|
||||
self.form.rowNavigationOptions = self.form.rowNavigationOptions | XLFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow;
|
||||
}
|
||||
else{
|
||||
self.form.rowNavigationOptions = self.form.rowNavigationOptions & (~XLFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(UIView *)inputAccessoryViewForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor
|
||||
{
|
||||
if ([[[self.form formRowWithTag:kAccessoryViewRowNavigationShowAccessoryView].value valueData] isEqual:@NO]){
|
||||
return nil;
|
||||
}
|
||||
return [super inputAccessoryViewForRowDescriptor:rowDescriptor];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,109 @@
|
||||
// CustomRowsViewController.swift
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014-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.
|
||||
|
||||
class CustomRowsViewController : XLFormViewController {
|
||||
|
||||
private struct Tags {
|
||||
static let CustomRowFirstRatingTag = "CustomRowFirstRatingTag"
|
||||
static let CustomRowSecondRatingTag = "CustomRowSecondRatingTag"
|
||||
static let CustomRowFloatLabeledTextFieldTag = "CustomRowFloatLabeledTextFieldTag"
|
||||
static let CustomRowWeekdays = "CustomRowWeekdays"
|
||||
static let CustomRowText = "CustomText"
|
||||
}
|
||||
|
||||
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
|
||||
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
|
||||
self.initializeForm()
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
self.initializeForm()
|
||||
}
|
||||
|
||||
func initializeForm() {
|
||||
|
||||
let form : XLFormDescriptor
|
||||
var section : XLFormSectionDescriptor
|
||||
var row : XLFormRowDescriptor
|
||||
|
||||
form = XLFormDescriptor(title: "Custom Rows")
|
||||
|
||||
section = XLFormSectionDescriptor()
|
||||
section.title = "Ratings"
|
||||
form.addFormSection(section)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.CustomRowFirstRatingTag, rowType: XLFormRowDescriptorTypeRate, title: "First Rating")
|
||||
row.value = 3
|
||||
section.addFormRow(row)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.CustomRowSecondRatingTag, rowType: XLFormRowDescriptorTypeRate, title: "First Rating")
|
||||
row.value = 1
|
||||
section.addFormRow(row)
|
||||
|
||||
// Section Float Labeled Text Field
|
||||
section = XLFormSectionDescriptor.formSectionWithTitle("Float Labeled Text Field")
|
||||
form.addFormSection(section)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.CustomRowFloatLabeledTextFieldTag, rowType: XLFormRowDescriptorTypeFloatLabeledTextField, title: "Title")
|
||||
section.addFormRow(row)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.CustomRowFloatLabeledTextFieldTag, rowType: XLFormRowDescriptorTypeFloatLabeledTextField, title: "First Name")
|
||||
section.addFormRow(row)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.CustomRowFloatLabeledTextFieldTag, rowType: XLFormRowDescriptorTypeFloatLabeledTextField, title: "Last Name")
|
||||
section.addFormRow(row)
|
||||
|
||||
|
||||
section = XLFormSectionDescriptor.formSectionWithTitle("Weekdays")
|
||||
form.addFormSection(section)
|
||||
|
||||
// WeekDays
|
||||
row = XLFormRowDescriptor(tag: Tags.CustomRowWeekdays, rowType: XLFormRowDescriptorTypeWeekDays)
|
||||
row.value = [
|
||||
XLFormWeekDaysCell.kWeekDay.Sunday.description(): false,
|
||||
XLFormWeekDaysCell.kWeekDay.Monday.description(): true,
|
||||
XLFormWeekDaysCell.kWeekDay.Tuesday.description(): true,
|
||||
XLFormWeekDaysCell.kWeekDay.Wednesday.description(): false,
|
||||
XLFormWeekDaysCell.kWeekDay.Thursday.description(): false,
|
||||
XLFormWeekDaysCell.kWeekDay.Friday.description(): false,
|
||||
XLFormWeekDaysCell.kWeekDay.Saturday.description(): false
|
||||
]
|
||||
section.addFormRow(row)
|
||||
|
||||
|
||||
section = XLFormSectionDescriptor()
|
||||
form.addFormSection(section)
|
||||
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.CustomRowText, rowType: XLFormRowDescriptorTypeCustom)
|
||||
// Must set custom cell or add custom cell to cellClassesForRowDescriptorTypes dictionary before XLFormViewController loaded
|
||||
row.cellClass = XLFormCustomCell.self
|
||||
section.addFormRow(row)
|
||||
|
||||
self.form = form
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
// FloatLabeledTextFieldCell.swift
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014-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.
|
||||
//
|
||||
|
||||
|
||||
let XLFormRowDescriptorTypeFloatLabeledTextField = "XLFormRowDescriptorTypeFloatLabeledTextField"
|
||||
|
||||
|
||||
class FloatLabeledTextFieldCell : XLFormBaseCell, UITextFieldDelegate {
|
||||
|
||||
static let kFontSize : CGFloat = 16.0
|
||||
|
||||
|
||||
lazy var floatLabeledTextField: JVFloatLabeledTextField = {
|
||||
let result = JVFloatLabeledTextField(frame: CGRect.zero)
|
||||
result.translatesAutoresizingMaskIntoConstraints = false
|
||||
result.font = UIFont.systemFontOfSize(kFontSize)
|
||||
result.floatingLabel.font = .boldSystemFontOfSize(kFontSize)
|
||||
result.clearButtonMode = .WhileEditing
|
||||
return result
|
||||
}()
|
||||
|
||||
//Mark: - XLFormDescriptorCell
|
||||
|
||||
override func configure() {
|
||||
super.configure()
|
||||
selectionStyle = .None
|
||||
contentView.addSubview(self.floatLabeledTextField)
|
||||
floatLabeledTextField.delegate = self
|
||||
contentView.addConstraints(layoutConstraints())
|
||||
}
|
||||
|
||||
override func update() {
|
||||
super.update()
|
||||
if let rowDescriptor = rowDescriptor {
|
||||
floatLabeledTextField.attributedPlaceholder = NSAttributedString(string: rowDescriptor.title ?? "" , attributes: [NSForegroundColorAttributeName: UIColor.lightGrayColor()])
|
||||
if let value = rowDescriptor.value {
|
||||
floatLabeledTextField.text = value.displayText()
|
||||
}
|
||||
else {
|
||||
floatLabeledTextField.text = rowDescriptor.noValueDisplayText
|
||||
}
|
||||
floatLabeledTextField.enabled = !rowDescriptor.isDisabled()
|
||||
floatLabeledTextField.floatingLabelTextColor = .lightGrayColor()
|
||||
floatLabeledTextField.alpha = rowDescriptor.isDisabled() ? 0.6 : 1.0
|
||||
}
|
||||
}
|
||||
|
||||
override func formDescriptorCellCanBecomeFirstResponder() -> Bool {
|
||||
return rowDescriptor?.isDisabled() == false
|
||||
}
|
||||
|
||||
|
||||
override func formDescriptorCellBecomeFirstResponder() -> Bool {
|
||||
return self.floatLabeledTextField.becomeFirstResponder()
|
||||
}
|
||||
|
||||
override static func formDescriptorCellHeightForRowDescriptor(rowDescriptor: XLFormRowDescriptor!) -> CGFloat {
|
||||
return 55.0
|
||||
}
|
||||
|
||||
|
||||
//MARK: Helpers
|
||||
|
||||
func layoutConstraints() -> [NSLayoutConstraint]{
|
||||
let views = ["floatLabeledTextField" : floatLabeledTextField]
|
||||
let metrics = ["hMargin": 15.0, "vMargin": 8.0]
|
||||
var result = NSLayoutConstraint.constraintsWithVisualFormat("H:|-(hMargin)-[floatLabeledTextField]-(hMargin)-|", options:.AlignAllCenterY, metrics:metrics, views:views)
|
||||
result += NSLayoutConstraint.constraintsWithVisualFormat("V:|-(vMargin)-[floatLabeledTextField]-(vMargin)-|", options:.AlignAllCenterX, metrics:metrics, views:views)
|
||||
return result
|
||||
}
|
||||
|
||||
func textFieldDidChange(textField : UITextField) {
|
||||
if floatLabeledTextField == textField {
|
||||
if let rowDescriptor = rowDescriptor, let text = self.floatLabeledTextField.text {
|
||||
if text.isEmpty == false {
|
||||
rowDescriptor.value = self.floatLabeledTextField.text
|
||||
} else {
|
||||
rowDescriptor.value = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Mark: UITextFieldDelegate
|
||||
|
||||
func textFieldShouldClear(textField: UITextField) -> Bool {
|
||||
return self.formViewController().textFieldShouldClear(textField)
|
||||
}
|
||||
|
||||
func textFieldShouldReturn(textField: UITextField) -> Bool {
|
||||
return self.formViewController().textFieldShouldReturn(textField)
|
||||
}
|
||||
|
||||
func textFieldShouldBeginEditing(textField: UITextField) -> Bool {
|
||||
return self.formViewController().textFieldShouldBeginEditing(textField)
|
||||
}
|
||||
|
||||
|
||||
func textFieldShouldEndEditing(textField: UITextField) -> Bool {
|
||||
return self.formViewController().textFieldShouldEndEditing(textField)
|
||||
}
|
||||
|
||||
|
||||
func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
|
||||
return self.formViewController().textField(textField, shouldChangeCharactersInRange: range, replacementString: string)
|
||||
}
|
||||
|
||||
func textFieldDidBeginEditing(textField: UITextField) {
|
||||
self.formViewController().textFieldDidBeginEditing(textField)
|
||||
}
|
||||
|
||||
|
||||
func textFieldDidEndEditing(textField: UITextField) {
|
||||
self.textFieldDidChange(textField)
|
||||
self.formViewController().textFieldDidEndEditing(textField)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// XLRatingView.swift
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014-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.
|
||||
|
||||
|
||||
class XLRatingView : AXRatingView {
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
translatesAutoresizingMaskIntoConstraints = false
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
translatesAutoresizingMaskIntoConstraints = false
|
||||
}
|
||||
|
||||
|
||||
func customize() {
|
||||
baseColor = UIColor(red: (205/255.0), green: (201/255.0), blue: (201/255.0), alpha: 1)
|
||||
highlightColor = UIColor(red: (255/255.0), green: (215/255.0), blue: 0, alpha: 1)
|
||||
markFont = UIFont.systemFontOfSize(23.0)
|
||||
stepInterval = 1.0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
// XLFormRatingCell.swift
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014-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.
|
||||
|
||||
|
||||
let XLFormRowDescriptorTypeRate = "XLFormRowDescriptorTypeRate"
|
||||
|
||||
|
||||
class XLFormRatingCell : XLFormBaseCell {
|
||||
|
||||
@IBOutlet weak var rateTitle: UILabel!
|
||||
@IBOutlet weak var ratingView: XLRatingView!
|
||||
|
||||
|
||||
override func configure() {
|
||||
super.configure()
|
||||
selectionStyle = .None
|
||||
ratingView.addTarget(self, action: "rateChanged:", forControlEvents:.ValueChanged)
|
||||
}
|
||||
|
||||
|
||||
override func update() {
|
||||
super.update()
|
||||
ratingView.value = rowDescriptor!.value!.floatValue
|
||||
rateTitle.text = rowDescriptor!.title
|
||||
ratingView.alpha = rowDescriptor!.isDisabled() ? 0.6 : 1
|
||||
rateTitle.alpha = rowDescriptor!.isDisabled() ? 0.6 : 1
|
||||
}
|
||||
|
||||
//MARK: Events
|
||||
|
||||
func rateChanged(ratingView : XLRatingView){
|
||||
rowDescriptor!.value = ratingView.value
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="15A279b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="OGo-4x-YLf" customClass="XLFormRatingCell" customModule="SwiftExample" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="478" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="OGo-4x-YLf" id="hV6-xt-6pq">
|
||||
<rect key="frame" x="0.0" y="0.0" width="478" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yhI-dj-sRk" customClass="XLRatingView" customModule="SwiftExample" customModuleProvider="target">
|
||||
<rect key="frame" x="353" y="11" width="115" height="22"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="22" id="85e-Ov-qM7"/>
|
||||
<constraint firstAttribute="width" constant="115" id="kOb-W4-HPs"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Rate" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vxp-gw-YTt">
|
||||
<rect key="frame" x="15" y="11" width="338" height="21"/>
|
||||
<animations/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="IK4-8e-SFs"/>
|
||||
<constraint firstAttribute="width" constant="150" id="hNG-F9-1wj"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="hNG-F9-1wj"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</label>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="Vxp-gw-YTt" secondAttribute="bottom" constant="11" id="0Qz-iR-Tzb"/>
|
||||
<constraint firstAttribute="centerY" secondItem="Vxp-gw-YTt" secondAttribute="centerY" id="4Vh-2e-m2p"/>
|
||||
<constraint firstAttribute="trailing" secondItem="yhI-dj-sRk" secondAttribute="trailing" constant="10" id="NPC-r7-JFl"/>
|
||||
<constraint firstAttribute="centerY" secondItem="yhI-dj-sRk" secondAttribute="centerY" id="Vw4-h8-wId"/>
|
||||
<constraint firstItem="Vxp-gw-YTt" firstAttribute="leading" secondItem="hV6-xt-6pq" secondAttribute="leading" constant="15" id="Xgq-Cy-zLQ"/>
|
||||
<constraint firstItem="Vxp-gw-YTt" firstAttribute="top" secondItem="hV6-xt-6pq" secondAttribute="top" constant="11" id="bgO-t8-Rjz"/>
|
||||
<constraint firstItem="yhI-dj-sRk" firstAttribute="leading" secondItem="Vxp-gw-YTt" secondAttribute="trailing" id="n0B-tg-Pik"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<animations/>
|
||||
<connections>
|
||||
<outlet property="rateTitle" destination="Vxp-gw-YTt" id="0Qh-NC-yq5"/>
|
||||
<outlet property="ratingView" destination="yhI-dj-sRk" id="BKM-pX-m9F"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="301" y="260"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,177 @@
|
||||
// XLFormWeekDaysCell.swift
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014-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.
|
||||
|
||||
|
||||
let XLFormRowDescriptorTypeWeekDays = "XLFormRowDescriptorTypeWeekDays"
|
||||
|
||||
|
||||
class XLFormWeekDaysCell : XLFormBaseCell {
|
||||
|
||||
enum kWeekDay: Int {
|
||||
case
|
||||
Sunday = 1,
|
||||
Monday,
|
||||
Tuesday,
|
||||
Wednesday,
|
||||
Thursday,
|
||||
Friday,
|
||||
Saturday
|
||||
|
||||
func description() -> String {
|
||||
switch self {
|
||||
case .Sunday:
|
||||
return "Sunday"
|
||||
case .Monday:
|
||||
return "Monday"
|
||||
case .Tuesday:
|
||||
return "Tuesday"
|
||||
case .Wednesday:
|
||||
return "Wednesday"
|
||||
case .Thursday:
|
||||
return "Thursday"
|
||||
case .Friday:
|
||||
return "Friday"
|
||||
case .Saturday:
|
||||
return "Saturday"
|
||||
}
|
||||
}
|
||||
|
||||
//Add Custom Functions
|
||||
|
||||
//Allows for iteration as needed (for in ...)
|
||||
static let allValues = [Sunday,
|
||||
Monday,
|
||||
Tuesday,
|
||||
Wednesday,
|
||||
Thursday,
|
||||
Friday,
|
||||
Saturday]
|
||||
}
|
||||
|
||||
@IBOutlet weak var sundayButton: UIButton!
|
||||
@IBOutlet weak var mondayButton: UIButton!
|
||||
@IBOutlet weak var tuesdayButton: UIButton!
|
||||
@IBOutlet weak var wednesdayButton: UIButton!
|
||||
@IBOutlet weak var thursdayButton: UIButton!
|
||||
@IBOutlet weak var fridayButton: UIButton!
|
||||
@IBOutlet weak var saturdayButton: UIButton!
|
||||
|
||||
//MARK: - XLFormDescriptorCell
|
||||
|
||||
override func configure() {
|
||||
super.configure()
|
||||
selectionStyle = .None
|
||||
configureButtons()
|
||||
}
|
||||
|
||||
|
||||
override func update() {
|
||||
super.update()
|
||||
updateButtons()
|
||||
}
|
||||
|
||||
override static func formDescriptorCellHeightForRowDescriptor(rowDescriptor: XLFormRowDescriptor!) -> CGFloat {
|
||||
return 60
|
||||
}
|
||||
|
||||
//MARK: - Action
|
||||
|
||||
@IBAction func dayTapped(sender: UIButton) {
|
||||
let day = getDayFormButton(sender)
|
||||
sender.selected = !sender.selected
|
||||
var newValue = rowDescriptor!.value as! Dictionary<String, Bool>
|
||||
newValue[day] = sender.selected
|
||||
rowDescriptor!.value = newValue
|
||||
}
|
||||
|
||||
//MARK: - Helpers
|
||||
|
||||
func configureButtons() {
|
||||
for subview in contentView.subviews {
|
||||
if let button = subview as? UIButton {
|
||||
button.setImage(UIImage(named: "uncheckedDay"), forState: .Normal)
|
||||
button.setImage(UIImage(named: "checkedDay"), forState: .Selected)
|
||||
button.adjustsImageWhenHighlighted = false
|
||||
imageTopTitleBottom(button)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func updateButtons() {
|
||||
var value = rowDescriptor!.value as! Dictionary<String, Bool>
|
||||
|
||||
sundayButton.selected = value[kWeekDay.Sunday.description()]!
|
||||
mondayButton.selected = value[kWeekDay.Monday.description()]!
|
||||
tuesdayButton.selected = value[kWeekDay.Tuesday.description()]!
|
||||
wednesdayButton.selected = value[kWeekDay.Wednesday.description()]!
|
||||
thursdayButton.selected = value[kWeekDay.Thursday.description()]!
|
||||
fridayButton.selected = value[kWeekDay.Friday.description()]!
|
||||
saturdayButton.selected = value[kWeekDay.Saturday.description()]!
|
||||
|
||||
sundayButton.alpha = rowDescriptor!.isDisabled() ? 0.6 : 1
|
||||
mondayButton.alpha = mondayButton.alpha
|
||||
tuesdayButton.alpha = mondayButton.alpha
|
||||
wednesdayButton.alpha = mondayButton.alpha
|
||||
thursdayButton.alpha = mondayButton.alpha
|
||||
fridayButton.alpha = mondayButton.alpha
|
||||
saturdayButton.alpha = mondayButton.alpha
|
||||
}
|
||||
|
||||
func imageTopTitleBottom(button: UIButton) {
|
||||
// the space between the image and text
|
||||
let spacing : CGFloat = 3.0
|
||||
|
||||
// lower the text and push it left so it appears centered
|
||||
// below the image
|
||||
let imageSize : CGSize = button.imageView!.image!.size
|
||||
button.titleEdgeInsets = UIEdgeInsets(top: 0.0, left: -imageSize.width, bottom: -(imageSize.height + spacing), right: 0.0)
|
||||
|
||||
// raise the image and push it right so it appears centered
|
||||
// above the text
|
||||
let titleSize : CGSize = (button.titleLabel!.text! as NSString).sizeWithAttributes([NSFontAttributeName: button.titleLabel!.font])
|
||||
button.imageEdgeInsets = UIEdgeInsetsMake(-(titleSize.height + spacing), 0.0, 0.0, -titleSize.width)
|
||||
}
|
||||
|
||||
func getDayFormButton(button: UIButton) -> String {
|
||||
switch button {
|
||||
case sundayButton:
|
||||
return kWeekDay.Sunday.description()
|
||||
case mondayButton:
|
||||
return kWeekDay.Monday.description()
|
||||
case tuesdayButton:
|
||||
return kWeekDay.Tuesday.description()
|
||||
case wednesdayButton:
|
||||
return kWeekDay.Wednesday.description()
|
||||
case thursdayButton:
|
||||
return kWeekDay.Thursday.description()
|
||||
case fridayButton:
|
||||
return kWeekDay.Friday.description()
|
||||
default:
|
||||
return kWeekDay.Saturday.description()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7531" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="60" id="piA-L5-eiN" customClass="XLFormWeekDaysCell" customModule="SwiftExample" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="382" height="50"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="piA-L5-eiN" id="Yr6-3E-keb">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZAg-Me-yKR">
|
||||
<rect key="frame" x="5" y="0.0" width="53" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="S">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<state key="selected">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="K4V-Xd-Bak"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UjQ-Cw-7wH" userLabel="separator 1">
|
||||
<rect key="frame" x="58" y="10" width="1" height="29"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="K3N-3h-MZr"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="N3w-qP-kRZ">
|
||||
<rect key="frame" x="58" y="0.0" width="53" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="M">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="FaQ-oB-Nkl"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kwc-0w-V51" userLabel="separator 2">
|
||||
<rect key="frame" x="111" y="10" width="1" height="29"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="3mE-sT-ql1"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cPl-47-rS8">
|
||||
<rect key="frame" x="111" y="0.0" width="53" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="T">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="4vk-5n-jge"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EiN-2p-Oig" userLabel="separator 3">
|
||||
<rect key="frame" x="164" y="10" width="1" height="29"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="JyW-GC-0A7"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6iC-Cl-RyI">
|
||||
<rect key="frame" x="164" y="0.0" width="54" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="W">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="oO1-zj-XRv"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bRc-5e-QAH" userLabel="separator 4">
|
||||
<rect key="frame" x="218" y="10" width="1" height="29"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="W9F-iR-Leh"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eTo-Ip-reh">
|
||||
<rect key="frame" x="218" y="0.0" width="53" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="T">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="SkQ-0a-9Fy"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dHj-rj-mjh" userLabel="separator 5">
|
||||
<rect key="frame" x="271" y="10" width="1" height="29"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="h5U-x0-9nJ"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Wjb-tu-QEo">
|
||||
<rect key="frame" x="271" y="0.0" width="53" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="F">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="9A8-9a-SGG"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="L7g-lu-boa" userLabel="separator 6">
|
||||
<rect key="frame" x="324" y="10" width="1" height="29"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="81t-Xh-wZT"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LNf-b4-GYP">
|
||||
<rect key="frame" x="324" y="0.0" width="53" height="49"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="S">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="I4k-Ho-KxE"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="ZAg-Me-yKR" firstAttribute="leading" secondItem="Yr6-3E-keb" secondAttribute="leading" constant="5" id="0EB-cP-ogn"/>
|
||||
<constraint firstItem="6iC-Cl-RyI" firstAttribute="width" secondItem="cPl-47-rS8" secondAttribute="width" id="1ZI-HN-9ew"/>
|
||||
<constraint firstItem="cPl-47-rS8" firstAttribute="leading" secondItem="N3w-qP-kRZ" secondAttribute="trailing" id="1pQ-h0-SEG"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="leading" secondItem="6iC-Cl-RyI" secondAttribute="trailing" constant="1" id="2UA-Ao-KZF"/>
|
||||
<constraint firstItem="dHj-rj-mjh" firstAttribute="height" secondItem="L7g-lu-boa" secondAttribute="height" id="4dj-Xx-ksP"/>
|
||||
<constraint firstAttribute="bottom" secondItem="EiN-2p-Oig" secondAttribute="bottom" constant="10" id="5eK-Bu-wpU"/>
|
||||
<constraint firstItem="N3w-qP-kRZ" firstAttribute="leading" secondItem="ZAg-Me-yKR" secondAttribute="trailing" id="67F-sV-r6W"/>
|
||||
<constraint firstItem="Wjb-tu-QEo" firstAttribute="leading" secondItem="dHj-rj-mjh" secondAttribute="trailing" id="6ZX-Ub-2vw"/>
|
||||
<constraint firstItem="EiN-2p-Oig" firstAttribute="height" secondItem="bRc-5e-QAH" secondAttribute="height" id="7Um-cV-f7p"/>
|
||||
<constraint firstItem="LNf-b4-GYP" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="7YT-x4-m88"/>
|
||||
<constraint firstItem="6iC-Cl-RyI" firstAttribute="trailing" secondItem="bRc-5e-QAH" secondAttribute="leading" id="ABd-MQ-9sp"/>
|
||||
<constraint firstAttribute="bottom" secondItem="UjQ-Cw-7wH" secondAttribute="bottom" constant="10" id="ASC-xR-Yxa"/>
|
||||
<constraint firstAttribute="bottom" secondItem="dHj-rj-mjh" secondAttribute="bottom" constant="10" id="ASP-um-b8o"/>
|
||||
<constraint firstItem="6iC-Cl-RyI" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="Aac-10-vTs"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="leading" secondItem="6iC-Cl-RyI" secondAttribute="trailing" id="BL5-PL-pac"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ZAg-Me-yKR" secondAttribute="bottom" id="BeZ-ar-qMN"/>
|
||||
<constraint firstItem="dHj-rj-mjh" firstAttribute="height" secondItem="bRc-5e-QAH" secondAttribute="height" id="DYn-Cd-g5H"/>
|
||||
<constraint firstAttribute="bottom" secondItem="kwc-0w-V51" secondAttribute="bottom" constant="10" id="EXu-BP-ftM"/>
|
||||
<constraint firstAttribute="bottom" secondItem="LNf-b4-GYP" secondAttribute="bottom" id="EYe-ne-rqO"/>
|
||||
<constraint firstItem="cPl-47-rS8" firstAttribute="leading" secondItem="N3w-qP-kRZ" secondAttribute="trailing" id="Fo8-Tp-bkn"/>
|
||||
<constraint firstItem="dHj-rj-mjh" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="GYq-pf-vR0"/>
|
||||
<constraint firstItem="cPl-47-rS8" firstAttribute="leading" secondItem="UjQ-Cw-7wH" secondAttribute="trailing" constant="72" id="HQ2-jA-X9g"/>
|
||||
<constraint firstItem="Wjb-tu-QEo" firstAttribute="leading" secondItem="eTo-Ip-reh" secondAttribute="trailing" id="I0s-Ze-pwV"/>
|
||||
<constraint firstAttribute="bottom" secondItem="bRc-5e-QAH" secondAttribute="bottom" constant="10" id="InL-Hk-twg"/>
|
||||
<constraint firstItem="UjQ-Cw-7wH" firstAttribute="leading" secondItem="ZAg-Me-yKR" secondAttribute="trailing" id="Jj4-jg-rdr"/>
|
||||
<constraint firstItem="6iC-Cl-RyI" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" id="KQe-Ei-8jY"/>
|
||||
<constraint firstItem="cPl-47-rS8" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="Kw5-3R-qXs"/>
|
||||
<constraint firstItem="bRc-5e-QAH" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="MXG-vB-U8F"/>
|
||||
<constraint firstItem="ZAg-Me-yKR" firstAttribute="width" secondItem="N3w-qP-kRZ" secondAttribute="width" id="Mem-UJ-5Js"/>
|
||||
<constraint firstItem="L7g-lu-boa" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="OVT-GJ-zq8"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" constant="25" id="OYQ-8o-3j8"/>
|
||||
<constraint firstItem="N3w-qP-kRZ" firstAttribute="width" secondItem="cPl-47-rS8" secondAttribute="width" id="Pl6-Xd-Krq"/>
|
||||
<constraint firstItem="Wjb-tu-QEo" firstAttribute="width" secondItem="LNf-b4-GYP" secondAttribute="width" id="Pro-fg-wBA"/>
|
||||
<constraint firstAttribute="bottom" secondItem="6iC-Cl-RyI" secondAttribute="bottom" id="Q5M-8N-hIh"/>
|
||||
<constraint firstItem="UjQ-Cw-7wH" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="RGn-ja-FRD"/>
|
||||
<constraint firstAttribute="trailing" secondItem="LNf-b4-GYP" secondAttribute="trailing" constant="5" id="RlS-d5-rIx"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="trailing" secondItem="cPl-47-rS8" secondAttribute="leading" id="Rs4-Pl-R8X"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="leading" secondItem="bRc-5e-QAH" secondAttribute="trailing" id="SO9-U6-cVO"/>
|
||||
<constraint firstAttribute="bottom" secondItem="N3w-qP-kRZ" secondAttribute="bottom" id="STf-aE-Y2E"/>
|
||||
<constraint firstAttribute="bottom" secondItem="kwc-0w-V51" secondAttribute="bottom" constant="10" id="SWG-oy-aZJ"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="TAb-IV-m7A"/>
|
||||
<constraint firstAttribute="bottom" secondItem="cPl-47-rS8" secondAttribute="bottom" id="Tmp-md-564"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="height" secondItem="UjQ-Cw-7wH" secondAttribute="height" id="Uli-Qb-6Om"/>
|
||||
<constraint firstItem="6iC-Cl-RyI" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" id="VcV-kz-XBb"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="width" secondItem="6iC-Cl-RyI" secondAttribute="width" id="X0k-jG-o63"/>
|
||||
<constraint firstItem="Wjb-tu-QEo" firstAttribute="leading" secondItem="eTo-Ip-reh" secondAttribute="trailing" id="cOc-P1-ZhU"/>
|
||||
<constraint firstItem="LNf-b4-GYP" firstAttribute="leading" secondItem="Wjb-tu-QEo" secondAttribute="trailing" id="dSr-cr-ebR"/>
|
||||
<constraint firstItem="EiN-2p-Oig" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="fgT-6k-CaP"/>
|
||||
<constraint firstItem="LNf-b4-GYP" firstAttribute="leading" secondItem="Wjb-tu-QEo" secondAttribute="trailing" id="gNl-wJ-ujY"/>
|
||||
<constraint firstItem="ZAg-Me-yKR" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="glN-lT-q1z"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="width" secondItem="Wjb-tu-QEo" secondAttribute="width" id="hEH-9C-pGZ"/>
|
||||
<constraint firstItem="EiN-2p-Oig" firstAttribute="height" secondItem="kwc-0w-V51" secondAttribute="height" id="hOI-fd-H7m"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="i5C-wG-rRN"/>
|
||||
<constraint firstItem="eTo-Ip-reh" firstAttribute="trailing" secondItem="dHj-rj-mjh" secondAttribute="leading" id="jsw-H6-2gQ"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" id="lQE-r9-9JT"/>
|
||||
<constraint firstAttribute="bottom" secondItem="L7g-lu-boa" secondAttribute="bottom" constant="10" id="lv1-xB-0zR"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="leading" secondItem="N3w-qP-kRZ" secondAttribute="trailing" id="oQe-Qf-9ZO"/>
|
||||
<constraint firstItem="Wjb-tu-QEo" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="pn7-s8-fDj"/>
|
||||
<constraint firstItem="EiN-2p-Oig" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" id="qIf-aB-2ZY"/>
|
||||
<constraint firstItem="6iC-Cl-RyI" firstAttribute="leading" secondItem="EiN-2p-Oig" secondAttribute="trailing" id="sAE-Nl-Puc"/>
|
||||
<constraint firstItem="LNf-b4-GYP" firstAttribute="leading" secondItem="L7g-lu-boa" secondAttribute="trailing" id="t1q-Nc-vbg"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="tVL-uj-6Ma"/>
|
||||
<constraint firstItem="Wjb-tu-QEo" firstAttribute="trailing" secondItem="L7g-lu-boa" secondAttribute="leading" id="u3Q-pF-E3A"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Wjb-tu-QEo" secondAttribute="bottom" id="uh4-LM-Ieo"/>
|
||||
<constraint firstItem="kwc-0w-V51" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" constant="25" id="vrx-0B-GOB"/>
|
||||
<constraint firstAttribute="bottom" secondItem="eTo-Ip-reh" secondAttribute="bottom" id="xIu-Vy-Nff"/>
|
||||
<constraint firstItem="N3w-qP-kRZ" firstAttribute="leading" secondItem="UjQ-Cw-7wH" secondAttribute="trailing" id="xWy-Uf-QEm"/>
|
||||
<constraint firstItem="N3w-qP-kRZ" firstAttribute="leading" secondItem="ZAg-Me-yKR" secondAttribute="trailing" id="xsx-BM-yQ5"/>
|
||||
<constraint firstItem="N3w-qP-kRZ" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="yEX-Wv-CZQ"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="67F-sV-r6W"/>
|
||||
<exclude reference="xWy-Uf-QEm"/>
|
||||
<exclude reference="1pQ-h0-SEG"/>
|
||||
<exclude reference="HQ2-jA-X9g"/>
|
||||
<exclude reference="OYQ-8o-3j8"/>
|
||||
<exclude reference="Rs4-Pl-R8X"/>
|
||||
<exclude reference="SWG-oy-aZJ"/>
|
||||
<exclude reference="TAb-IV-m7A"/>
|
||||
<exclude reference="Uli-Qb-6Om"/>
|
||||
<exclude reference="lQE-r9-9JT"/>
|
||||
<exclude reference="vrx-0B-GOB"/>
|
||||
<exclude reference="KQe-Ei-8jY"/>
|
||||
<exclude reference="sAE-Nl-Puc"/>
|
||||
<exclude reference="7Um-cV-f7p"/>
|
||||
<exclude reference="hOI-fd-H7m"/>
|
||||
<exclude reference="2UA-Ao-KZF"/>
|
||||
<exclude reference="SO9-U6-cVO"/>
|
||||
<exclude reference="6ZX-Ub-2vw"/>
|
||||
<exclude reference="cOc-P1-ZhU"/>
|
||||
<exclude reference="4dj-Xx-ksP"/>
|
||||
<exclude reference="DYn-Cd-g5H"/>
|
||||
<exclude reference="dSr-cr-ebR"/>
|
||||
<exclude reference="t1q-Nc-vbg"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="fridayButton" destination="Wjb-tu-QEo" id="AcP-Qg-i9P"/>
|
||||
<outlet property="mondayButton" destination="N3w-qP-kRZ" id="u3A-mt-EKd"/>
|
||||
<outlet property="saturdayButton" destination="LNf-b4-GYP" id="TeM-3b-B1Z"/>
|
||||
<outlet property="sundayButton" destination="ZAg-Me-yKR" id="GUI-ry-Hm1"/>
|
||||
<outlet property="thursdayButton" destination="eTo-Ip-reh" id="Dxi-hi-oBK"/>
|
||||
<outlet property="tuesdayButton" destination="cPl-47-rS8" id="wIn-mO-cUx"/>
|
||||
<outlet property="wednesdayButton" destination="6iC-Cl-RyI" id="GQe-Oy-pcd"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="296" y="222"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// DateAndTimeValueTransformer.swift
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014-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.
|
||||
|
||||
class DateValueTrasformer : NSValueTransformer {
|
||||
|
||||
override class func transformedValueClass() -> AnyClass {
|
||||
return NSString.self
|
||||
}
|
||||
|
||||
|
||||
override class func allowsReverseTransformation() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
override func transformedValue(value: AnyObject?) -> AnyObject? {
|
||||
if let date = value as? NSDate {
|
||||
let dateFormatter = NSDateFormatter()
|
||||
dateFormatter.dateStyle = .FullStyle
|
||||
dateFormatter.timeStyle = .NoStyle
|
||||
return dateFormatter.stringFromDate(date)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
class DateTimeValueTrasformer: NSValueTransformer {
|
||||
|
||||
override class func transformedValueClass() -> AnyClass {
|
||||
return NSString.self
|
||||
}
|
||||
|
||||
|
||||
override class func allowsReverseTransformation() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
override func transformedValue(value: AnyObject?) -> AnyObject? {
|
||||
if let date = value as? NSDate {
|
||||
let dateFormatter = NSDateFormatter()
|
||||
dateFormatter.dateStyle = .MediumStyle
|
||||
dateFormatter.timeStyle = .ShortStyle
|
||||
return dateFormatter.stringFromDate(date)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
// DatesFormViewController.swift
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
|
||||
// Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com )
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -26,46 +26,137 @@
|
||||
|
||||
class DatesFormViewController: XLFormViewController {
|
||||
|
||||
struct tag {
|
||||
static let dateTime = "dateTime"
|
||||
static let date = "date"
|
||||
static let time = "time"
|
||||
private struct Tags {
|
||||
static let DateInline = "dateInline"
|
||||
static let TimeInline = "timeInline"
|
||||
static let DateTimeInline = "dateTimeInline"
|
||||
static let CountDownTimerInline = "countDownTimerInline"
|
||||
static let DatePicker = "datePicker"
|
||||
static let Date = "date"
|
||||
static let Time = "time"
|
||||
static let DateTime = "dateTime"
|
||||
static let CountDownTimer = "countDownTimer"
|
||||
}
|
||||
|
||||
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
|
||||
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
|
||||
initializeForm()
|
||||
}
|
||||
|
||||
required init(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder);
|
||||
self.initializeForm()
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
initializeForm()
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
let barButton = UIBarButtonItem(title: "Disable", style: .Plain, target: self, action: "disableEnable:")
|
||||
barButton.possibleTitles = Set(["Disable", "Enable"])
|
||||
navigationItem.rightBarButtonItem = barButton
|
||||
}
|
||||
|
||||
|
||||
func disableEnable(button : UIBarButtonItem){
|
||||
form.disabled = !form.disabled
|
||||
button.title = form.disabled ? "Enable" : "Disable"
|
||||
tableView.endEditing(true)
|
||||
tableView.reloadData()
|
||||
}
|
||||
|
||||
func initializeForm() {
|
||||
var form : XLFormDescriptor
|
||||
let form : XLFormDescriptor
|
||||
var section : XLFormSectionDescriptor
|
||||
var row : XLFormRowDescriptor
|
||||
|
||||
form = XLFormDescriptor.formDescriptorWithTitle("Dates") as XLFormDescriptor
|
||||
form = XLFormDescriptor(title: "Date & Time")
|
||||
|
||||
section = XLFormSectionDescriptor.formSectionWithTitle("Inline Dates") as XLFormSectionDescriptor
|
||||
section = XLFormSectionDescriptor.formSectionWithTitle("Inline Dates")
|
||||
form.addFormSection(section)
|
||||
|
||||
// Date
|
||||
row = XLFormRowDescriptor(tag: tag.date, rowType: XLFormRowDescriptorTypeDateInline, title:"Date")
|
||||
row = XLFormRowDescriptor(tag: Tags.DateInline, rowType: XLFormRowDescriptorTypeDateInline, title:"Date")
|
||||
row.value = NSDate()
|
||||
section.addFormRow(row)
|
||||
|
||||
// Time
|
||||
row = XLFormRowDescriptor(tag: tag.time, rowType: XLFormRowDescriptorTypeTimeInline, title: "Time")
|
||||
row = XLFormRowDescriptor(tag: Tags.TimeInline, rowType: XLFormRowDescriptorTypeTimeInline, title: "Time")
|
||||
row.value = NSDate()
|
||||
section.addFormRow(row)
|
||||
|
||||
// DateTime
|
||||
row = XLFormRowDescriptor(tag: tag.dateTime, rowType: XLFormRowDescriptorTypeDateTimeInline, title: "Date Time")
|
||||
row = XLFormRowDescriptor(tag: Tags.DateTimeInline, rowType: XLFormRowDescriptorTypeDateTimeInline, title: "Date Time")
|
||||
row.value = NSDate()
|
||||
section.addFormRow(row)
|
||||
self.form = form;
|
||||
|
||||
// CountDownTimer
|
||||
row = XLFormRowDescriptor(tag: Tags.CountDownTimerInline, rowType:XLFormRowDescriptorTypeCountDownTimerInline, title:"Countdown Timer")
|
||||
row.value = NSDate()
|
||||
section.addFormRow(row)
|
||||
|
||||
|
||||
section = XLFormSectionDescriptor.formSectionWithTitle("Dates") //
|
||||
form.addFormSection(section)
|
||||
|
||||
|
||||
// Date
|
||||
row = XLFormRowDescriptor(tag: Tags.Date, rowType:XLFormRowDescriptorTypeDate, title:"Date")
|
||||
row.value = NSDate()
|
||||
row.cellConfigAtConfigure["minimumDate"] = NSDate()
|
||||
row.cellConfigAtConfigure["maximumDate"] = NSDate(timeIntervalSinceNow: 60*60*24*3)
|
||||
section.addFormRow(row)
|
||||
|
||||
// Time
|
||||
row = XLFormRowDescriptor(tag: Tags.Time, rowType: XLFormRowDescriptorTypeTime, title: "Time")
|
||||
row.cellConfigAtConfigure["minuteInterval"] = 10
|
||||
row.value = NSDate()
|
||||
section.addFormRow(row)
|
||||
|
||||
// DateTime
|
||||
row = XLFormRowDescriptor(tag: Tags.DateTime, rowType: XLFormRowDescriptorTypeDateTime, title: "Date Time")
|
||||
row.value = NSDate()
|
||||
section.addFormRow(row)
|
||||
|
||||
// CountDownTimer
|
||||
row = XLFormRowDescriptor(tag: Tags.CountDownTimer, rowType: XLFormRowDescriptorTypeCountDownTimer, title: "Countdown Timer")
|
||||
row.value = NSDate()
|
||||
section.addFormRow(row)
|
||||
|
||||
|
||||
section = XLFormSectionDescriptor.formSectionWithTitle("Disabled Dates")
|
||||
section.footerTitle = "DatesFormViewController.swift"
|
||||
form.addFormSection(section)
|
||||
|
||||
// Date
|
||||
row = XLFormRowDescriptor(tag: nil, rowType: XLFormRowDescriptorTypeDate, title: "Date")
|
||||
row.disabled = NSNumber(bool: true)
|
||||
row.required = true
|
||||
row.value = NSDate()
|
||||
section.addFormRow(row)
|
||||
|
||||
|
||||
|
||||
section = XLFormSectionDescriptor.formSectionWithTitle("DatePicker")
|
||||
form.addFormSection(section)
|
||||
|
||||
// DatePicker
|
||||
row = XLFormRowDescriptor(tag: Tags.DatePicker, rowType:XLFormRowDescriptorTypeDatePicker)
|
||||
row.cellConfigAtConfigure["datePicker.datePickerMode"] = UIDatePickerMode.Date.rawValue
|
||||
row.value = NSDate()
|
||||
section.addFormRow(row)
|
||||
|
||||
|
||||
self.form = form
|
||||
}
|
||||
|
||||
|
||||
// MARK: - XLFormDescriptorDelegate
|
||||
|
||||
override func formRowDescriptorValueHasChanged(formRow: XLFormRowDescriptor!, oldValue: AnyObject!, newValue: AnyObject!) {
|
||||
super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
|
||||
if formRow.tag == Tags.DatePicker {
|
||||
let alertView = UIAlertView(title: "DatePicker", message: "Value Has changed!", delegate: self, cancelButtonTitle: "OK")
|
||||
alertView.show()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
//
|
||||
// ExamplesFormViewController.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 "InputsFormViewController.h"
|
||||
#import "SelectorsFormViewController.h"
|
||||
#import "OthersFormViewController.h"
|
||||
#import "DatesFormViewController.h"
|
||||
#import "MultiValuedFormViewController.h"
|
||||
#import "ExamplesFormViewController.h"
|
||||
#import "NativeEventFormViewController.h"
|
||||
#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 ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation ExamplesFormViewController
|
||||
|
||||
|
||||
-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||||
{
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
if (self){
|
||||
[self initializeForm];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
-(id)initWithCoder:(NSCoder *)aDecoder
|
||||
{
|
||||
self = [super initWithCoder:aDecoder];
|
||||
if (self){
|
||||
[self initializeForm];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Helper
|
||||
|
||||
-(void)initializeForm
|
||||
{
|
||||
XLFormDescriptor * form;
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
form = [XLFormDescriptor formDescriptor];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Real examples"];
|
||||
[form addFormSection:section];
|
||||
|
||||
// NativeEventFormViewController
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"realExamples" rowType:XLFormRowDescriptorTypeButton title:@"iOS Calendar Event Form"];
|
||||
row.action.formSegueIdenfifier = @"NativeEventNavigationViewControllerSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"This form is actually an example"];
|
||||
section.footerTitle = @"ExamplesFormViewController.h, Select an option to view another example";
|
||||
[form addFormSection:section];
|
||||
|
||||
|
||||
// TextFieldAndTextView
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kTextFieldAndTextView rowType:XLFormRowDescriptorTypeButton title:@"Text Fields"];
|
||||
row.action.viewControllerClass = [InputsFormViewController class];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Selectors
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectors rowType:XLFormRowDescriptorTypeButton title:@"Selectors"];
|
||||
row.action.formSegueIdenfifier = @"SelectorsFormViewControllerSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
// Dates
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDates rowType:XLFormRowDescriptorTypeButton title:@"Date & Time"];
|
||||
row.action.viewControllerClass = [DatesFormViewController class];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Others
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kOthes rowType:XLFormRowDescriptorTypeButton title:@"Other Rows"];
|
||||
row.action.formSegueIdenfifier = @"OthersFormViewControllerSegue";
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multivalued example"];
|
||||
[form addFormSection:section];
|
||||
|
||||
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];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivalued rowType:XLFormRowDescriptorTypeButton title:@"UI Customization"];
|
||||
row.action.viewControllerClass = [UICustomizationFormViewController class];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Custom Rows"];
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivalued rowType:XLFormRowDescriptorTypeButton title:@"Custom Rows"];
|
||||
row.action.viewControllerClass = [CustomRowsViewController class];
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Accessory View"];
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivalued rowType:XLFormRowDescriptorTypeButton title:@"Accessory Views"];
|
||||
row.action.viewControllerClass = [AccessoryViewFormViewController class];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Validation Examples"];
|
||||
[form addFormSection:section];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kValidations rowType:XLFormRowDescriptorTypeButton title:@"Validation Examples"];
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// InputsFormViewController.swift
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014-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.
|
||||
|
||||
|
||||
class InputsFormViewController : XLFormViewController {
|
||||
|
||||
private struct Tags {
|
||||
static let Name = "name"
|
||||
static let Email = "email"
|
||||
static let Twitter = "twitter"
|
||||
static let Number = "number"
|
||||
static let Integer = "integer"
|
||||
static let Decimal = "decimal"
|
||||
static let Password = "password"
|
||||
static let Phone = "phone"
|
||||
static let Url = "url"
|
||||
static let ZipCode = "zipCode"
|
||||
static let TextView = "textView"
|
||||
static let Notes = "notes"
|
||||
}
|
||||
|
||||
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
|
||||
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
|
||||
initializeForm()
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
initializeForm()
|
||||
}
|
||||
|
||||
func initializeForm() {
|
||||
|
||||
let form : XLFormDescriptor
|
||||
var section : XLFormSectionDescriptor
|
||||
var row : XLFormRowDescriptor
|
||||
|
||||
form = XLFormDescriptor(title: "Text Fields")
|
||||
form.assignFirstResponderOnShow = true
|
||||
|
||||
section = XLFormSectionDescriptor.formSectionWithTitle("TextField Types")
|
||||
section.footerTitle = "This is a long text that will appear on section footer"
|
||||
form.addFormSection(section)
|
||||
|
||||
|
||||
// Name
|
||||
row = XLFormRowDescriptor(tag: Tags.Name, rowType: XLFormRowDescriptorTypeText, title: "Name")
|
||||
row.required = true
|
||||
section.addFormRow(row)
|
||||
|
||||
// Email
|
||||
row = XLFormRowDescriptor(tag: Tags.Email, rowType: XLFormRowDescriptorTypeEmail, title: "Email")
|
||||
// validate the email
|
||||
row.addValidator(XLFormValidator.emailValidator())
|
||||
section.addFormRow(row)
|
||||
|
||||
// Twitter
|
||||
row = XLFormRowDescriptor(tag: Tags.Name, rowType: XLFormRowDescriptorTypeTwitter, title: "Twitter")
|
||||
row.disabled = NSNumber(bool: true)
|
||||
row.value = "@no_editable"
|
||||
section.addFormRow(row)
|
||||
|
||||
// Zip Code
|
||||
row = XLFormRowDescriptor(tag: Tags.ZipCode, rowType: XLFormRowDescriptorTypeZipCode, title: "Zip Code")
|
||||
section.addFormRow(row)
|
||||
|
||||
// Number
|
||||
row = XLFormRowDescriptor(tag: Tags.Number, rowType: XLFormRowDescriptorTypeNumber, title: "Number")
|
||||
section.addFormRow(row)
|
||||
|
||||
// Integer
|
||||
row = XLFormRowDescriptor(tag: Tags.Integer, rowType: XLFormRowDescriptorTypeInteger, title: "Integer")
|
||||
section.addFormRow(row)
|
||||
|
||||
// Decimal
|
||||
row = XLFormRowDescriptor(tag: Tags.Decimal, rowType: XLFormRowDescriptorTypeDecimal, title: "Decimal")
|
||||
section.addFormRow(row)
|
||||
|
||||
// Password
|
||||
row = XLFormRowDescriptor(tag: Tags.Password, rowType: XLFormRowDescriptorTypePassword, title: "Password")
|
||||
section.addFormRow(row)
|
||||
|
||||
// Phone
|
||||
row = XLFormRowDescriptor(tag: Tags.Phone, rowType: XLFormRowDescriptorTypePhone, title: "Phone")
|
||||
section.addFormRow(row)
|
||||
|
||||
// Url
|
||||
row = XLFormRowDescriptor(tag: Tags.Url, rowType: XLFormRowDescriptorTypeURL, title: "Url")
|
||||
section.addFormRow(row)
|
||||
|
||||
|
||||
section = XLFormSectionDescriptor.formSection()
|
||||
form.addFormSection(section)
|
||||
|
||||
|
||||
// TextView
|
||||
row = XLFormRowDescriptor(tag: Tags.TextView, rowType: XLFormRowDescriptorTypeTextView)
|
||||
row.cellConfigAtConfigure["textView.placeholder"] = "TEXT VIEW EXAMPLE"
|
||||
section.addFormRow(row)
|
||||
|
||||
|
||||
section = XLFormSectionDescriptor.formSectionWithTitle("TextView With Label Example")
|
||||
form.addFormSection(section)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.Number, rowType: XLFormRowDescriptorTypeTextView, title: "Notes")
|
||||
section.addFormRow(row)
|
||||
|
||||
self.form = form
|
||||
|
||||
}
|
||||
|
||||
override func viewDidLoad()
|
||||
{
|
||||
super.viewDidLoad()
|
||||
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Save, target: self, action: "savePressed:")
|
||||
}
|
||||
|
||||
func savePressed(button: UIBarButtonItem)
|
||||
{
|
||||
let validationErrors : Array<NSError> = self.formValidationErrors() as! Array<NSError>
|
||||
if (validationErrors.count > 0){
|
||||
self.showFormValidationError(validationErrors.first)
|
||||
return
|
||||
}
|
||||
self.tableView.endEditing(true)
|
||||
let alertView = UIAlertView(title: "Valid Form", message: "No errors found", delegate: self, cancelButtonTitle: "OK")
|
||||
alertView.show()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
//
|
||||
// MultiValuedFormViewController.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 "XLForm.h"
|
||||
#import "SelectorsFormViewController.h"
|
||||
#import "MultiValuedFormViewController.h"
|
||||
|
||||
|
||||
@implementation MultivaluedFormViewController
|
||||
|
||||
- (id)init
|
||||
{
|
||||
XLFormDescriptor * form;
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
form = [XLFormDescriptor formDescriptorWithTitle:@"Multivalued Examples"];
|
||||
|
||||
// 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 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"];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
// Another one
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multivalued Push Selector example"
|
||||
sectionOptions:XLFormSectionOptionCanInsert | XLFormSectionOptionCanDelete | XLFormSectionOptionCanReorder
|
||||
sectionInsertMode:XLFormSectionInsertModeButton];
|
||||
section.footerTitle = @"MultivaluedFormViewController.h";
|
||||
[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];
|
||||
[section addFormRow:row];
|
||||
return [super initWithForm:form];
|
||||
}
|
||||
|
||||
|
||||
-(void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(addDidTouch:)];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
-(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];
|
||||
[actionSheet showInView:self.view];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - UIActionSheetDelegate
|
||||
|
||||
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||
{
|
||||
if ([actionSheet destructiveButtonIndex] == buttonIndex){
|
||||
if (self.form.formSections.count > 0){
|
||||
// remove last section
|
||||
[self.form removeFormSectionAtIndex:(self.form.formSections.count - 1)];
|
||||
}
|
||||
}
|
||||
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)];
|
||||
XLFormRowDescriptor * newRow = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorPush title:@"Tap to select ;).."];
|
||||
newRow.selectorOptions = @[@"Option 1", @"Option 2", @"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
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// XLFormCustomCell.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 "XLFormCustomCell.h"
|
||||
|
||||
@implementation XLFormCustomCell
|
||||
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
// Initialization code
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)configure
|
||||
{
|
||||
[super configure];
|
||||
//override
|
||||
}
|
||||
|
||||
- (void)update
|
||||
{
|
||||
[super update];
|
||||
// override
|
||||
self.textLabel.text = @"Am a custom cell, select me!";
|
||||
}
|
||||
|
||||
-(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller
|
||||
{
|
||||
// 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.rowDescriptor.value = self.textLabel.text;
|
||||
[self.formViewController.tableView selectRowAtIndexPath:nil animated:YES scrollPosition:UITableViewScrollPositionNone];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,188 @@
|
||||
//
|
||||
// OthersFormViewController.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 "MapViewController.h"
|
||||
#import "OthersFormViewController.h"
|
||||
|
||||
NSString *const kSwitchBool = @"switchBool";
|
||||
NSString *const kSwitchCheck = @"switchBool";
|
||||
NSString *const kStepCounter = @"stepCounter";
|
||||
NSString *const kSlider = @"slider";
|
||||
NSString *const kSegmentedControl = @"segmentedControl";
|
||||
NSString *const kCustom = @"custom";
|
||||
NSString *const kInfo = @"info";
|
||||
NSString *const kButton = @"button";
|
||||
NSString *const kButtonLeftAligned = @"buttonLeftAligned";
|
||||
NSString *const kButtonWithSegueId = @"buttonWithSegueId";
|
||||
NSString *const kButtonWithSegueClass = @"buttonWithSegueClass";
|
||||
NSString *const kButtonWithNibName = @"buttonWithNibName";
|
||||
NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
|
||||
|
||||
@implementation OthersFormViewController
|
||||
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
if (self) {
|
||||
[self initializeForm];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self){
|
||||
[self initializeForm];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initializeForm
|
||||
{
|
||||
XLFormDescriptor * form = [XLFormDescriptor formDescriptorWithTitle:@"Other Cells"];
|
||||
XLFormSectionDescriptor * section;
|
||||
|
||||
// Basic Information
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Other Cells"];
|
||||
section.footerTitle = @"OthersFormViewController.h";
|
||||
[form addFormSection:section];
|
||||
|
||||
// Switch
|
||||
[section addFormRow:[XLFormRowDescriptor formRowDescriptorWithTag:kSwitchBool rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Switch"]];
|
||||
|
||||
// check
|
||||
[section addFormRow:[XLFormRowDescriptor formRowDescriptorWithTag:kSwitchCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Check"]];
|
||||
|
||||
// step counter
|
||||
[section addFormRow:[XLFormRowDescriptor formRowDescriptorWithTag:kStepCounter rowType:XLFormRowDescriptorTypeStepCounter title:@"Step counter"]];
|
||||
|
||||
// Segmented Control
|
||||
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:kSegmentedControl rowType:XLFormRowDescriptorTypeSelectorSegmentedControl title:@"Fruits"];
|
||||
row.selectorOptions = @[@"Apple", @"Orange", @"Pear"];
|
||||
row.value = @"Pear";
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
// Slider
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSlider rowType:XLFormRowDescriptorTypeSlider title:@"Slider"];
|
||||
row.value = @(30);
|
||||
[row.cellConfigAtConfigure setObject:@(100) forKey:@"slider.maximumValue"];
|
||||
[row.cellConfigAtConfigure setObject:@(10) forKey:@"slider.minimumValue"];
|
||||
[row.cellConfigAtConfigure setObject:@(4) forKey:@"steps"];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
// Info cell
|
||||
XLFormRowDescriptor *infoRowDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:kInfo rowType:XLFormRowDescriptorTypeInfo];
|
||||
infoRowDescriptor.title = @"Version";
|
||||
infoRowDescriptor.value = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
|
||||
[section addFormRow:infoRowDescriptor];
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSectionWithTitle:@"Buttons"];
|
||||
section.footerTitle = @"Blue buttons will show a message when Switch is ON";
|
||||
[form addFormSection:section];
|
||||
|
||||
// Button
|
||||
XLFormRowDescriptor * buttonRow = [XLFormRowDescriptor formRowDescriptorWithTag:kButton rowType:XLFormRowDescriptorTypeButton title:@"Button"];
|
||||
[buttonRow.cellConfig setObject:[UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0] forKey:@"textLabel.textColor"];
|
||||
buttonRow.action.formSelector = @selector(didTouchButton:);
|
||||
[section addFormRow:buttonRow];
|
||||
|
||||
|
||||
// Left Button
|
||||
XLFormRowDescriptor * buttonLeftAlignedRow = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonLeftAligned rowType:XLFormRowDescriptorTypeButton title:@"Button with Block"];
|
||||
[buttonLeftAlignedRow.cellConfig setObject:[UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0] forKey:@"textLabel.textColor"];
|
||||
[buttonLeftAlignedRow.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
|
||||
[buttonLeftAlignedRow.cellConfig setObject:@(UITableViewCellAccessoryDisclosureIndicator) forKey:@"accessoryType"];
|
||||
buttonLeftAlignedRow.action.formBlock = ^(XLFormRowDescriptor * sender){
|
||||
if ([[sender.sectionDescriptor.formDescriptor formRowWithTag:kSwitchBool].value boolValue]){
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil) message:@"Button has checked the switch value..." delegate:self cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
}
|
||||
[self deselectFormRow:sender];
|
||||
};
|
||||
[section addFormRow:buttonLeftAlignedRow];
|
||||
|
||||
// Another Left Button with segue
|
||||
XLFormRowDescriptor * buttonLeftAlignedWithSegueRow = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonWithSegueClass rowType:XLFormRowDescriptorTypeButton title:@"Button with Segue Class"];
|
||||
buttonLeftAlignedWithSegueRow.action.formSegueClass = NSClassFromString(@"UIStoryboardPushSegue");
|
||||
buttonLeftAlignedWithSegueRow.action.viewControllerClass = [MapViewController class];
|
||||
[section addFormRow:buttonLeftAlignedWithSegueRow];
|
||||
|
||||
|
||||
// Button with SegueId
|
||||
XLFormRowDescriptor * buttonWithSegueId = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonWithSegueClass rowType:XLFormRowDescriptorTypeButton title:@"Button with Segue Idenfifier"];
|
||||
buttonWithSegueId.action.formSegueIdenfifier = @"MapViewControllerSegue";
|
||||
[section addFormRow:buttonWithSegueId];
|
||||
|
||||
|
||||
// Another Button using Segue
|
||||
XLFormRowDescriptor * buttonWithStoryboardId = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonWithStoryboardId rowType:XLFormRowDescriptorTypeButton title:@"Button with StoryboardId"];
|
||||
buttonWithStoryboardId.action.viewControllerStoryboardId = @"MapViewController";
|
||||
[section addFormRow:buttonWithStoryboardId];
|
||||
|
||||
// Another Left Button with segue
|
||||
XLFormRowDescriptor * buttonWithNibName = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonWithNibName
|
||||
rowType:XLFormRowDescriptorTypeButton
|
||||
title:@"Button with NibName"];
|
||||
buttonWithNibName.action.viewControllerNibName = @"MapViewController";
|
||||
[section addFormRow:buttonWithNibName];
|
||||
|
||||
self.form = form;
|
||||
}
|
||||
|
||||
-(void)didTouchButton:(XLFormRowDescriptor *)sender
|
||||
{
|
||||
if ([[sender.sectionDescriptor.formDescriptor formRowWithTag:kSwitchBool].value boolValue]){
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil) message:@"Button has checked the switch value..." delegate:self cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
}
|
||||
[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
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// BlogExampleViewController.swift
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014-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.
|
||||
|
||||
class BlogExampleViewController : XLFormViewController {
|
||||
|
||||
private struct Tags {
|
||||
static let Hobbies = "hobbies"
|
||||
static let Sport = "sport"
|
||||
static let Film = "films1"
|
||||
static let Film2 = "films2"
|
||||
static let Music = "music"
|
||||
}
|
||||
|
||||
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
|
||||
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
|
||||
initializeForm()
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
initializeForm()
|
||||
}
|
||||
|
||||
func initializeForm() {
|
||||
|
||||
let form : XLFormDescriptor
|
||||
var section : XLFormSectionDescriptor
|
||||
var row : XLFormRowDescriptor
|
||||
|
||||
form = XLFormDescriptor(title: "Blog Example: Hobbies")
|
||||
|
||||
section = XLFormSectionDescriptor()
|
||||
section.title = "Hobbies"
|
||||
form.addFormSection(section)
|
||||
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.Hobbies, rowType: XLFormRowDescriptorTypeMultipleSelector, title:"Select Hobbies")
|
||||
row.selectorOptions = ["Sport", "Music", "Films"]
|
||||
row.value = []
|
||||
section.addFormRow(row)
|
||||
|
||||
section = XLFormSectionDescriptor()
|
||||
section.title = "Some more questions"
|
||||
section.hidden = NSPredicate(format: "$\(row.description).value.@count == 0")
|
||||
section.footerTitle = "BlogExampleViewController.swift"
|
||||
form.addFormSection(section)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.Sport, rowType: XLFormRowDescriptorTypeTextView, title:"Your favourite sportsman?")
|
||||
row.hidden = "NOT $\(Tags.Hobbies).value contains 'Sport'"
|
||||
section.addFormRow(row)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.Film, rowType:XLFormRowDescriptorTypeTextView, title: "Your favourite film?")
|
||||
row.hidden = "NOT $\(Tags.Hobbies) contains 'Films'"
|
||||
section.addFormRow(row)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.Film2, rowType:XLFormRowDescriptorTypeTextView, title:"Your favourite actor?")
|
||||
row.hidden = "NOT $\(Tags.Hobbies) contains 'Films'"
|
||||
section.addFormRow(row)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.Music, rowType:XLFormRowDescriptorTypeTextView, title:"Your favourite singer?")
|
||||
row.hidden = "NOT $\(Tags.Hobbies) contains 'Music'"
|
||||
section.addFormRow(row)
|
||||
|
||||
self.form = form
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
//
|
||||
// PredicateFormViewController.swift
|
||||
// XLForm ( https://github.com/xmartlabs/XLForm )
|
||||
//
|
||||
// Copyright (c) 2014-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.
|
||||
|
||||
|
||||
class PredicateFormViewController : XLFormViewController {
|
||||
|
||||
private struct Tags {
|
||||
static let Text = "text"
|
||||
static let Integer = "integer"
|
||||
static let Switch = "switch"
|
||||
static let Date = "date"
|
||||
static let Account = "account"
|
||||
}
|
||||
|
||||
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
|
||||
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
|
||||
initializeForm()
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
initializeForm()
|
||||
}
|
||||
|
||||
func initializeForm() {
|
||||
|
||||
let form : XLFormDescriptor
|
||||
var section : XLFormSectionDescriptor
|
||||
var row : XLFormRowDescriptor
|
||||
|
||||
form = XLFormDescriptor(title: "Predicates example")
|
||||
|
||||
section = XLFormSectionDescriptor()
|
||||
section.title = "Independent rows"
|
||||
form.addFormSection(section)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.Text, rowType: XLFormRowDescriptorTypeAccount, title:"Text")
|
||||
row.cellConfigAtConfigure["textField.placeholder"] = "Type disable"
|
||||
section.addFormRow(row)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.Integer, rowType: XLFormRowDescriptorTypeInteger, title:"Integer")
|
||||
row.hidden = NSPredicate(format: "$\(Tags.Switch).value==0")
|
||||
section.addFormRow(row)
|
||||
|
||||
row = XLFormRowDescriptor(tag: Tags.Switch, rowType: XLFormRowDescriptorTypeBooleanSwitch, title:"Boolean")
|
||||
row.value = true
|
||||
section.addFormRow(row)
|
||||
|
||||
form.addFormSection(section)
|
||||
|
||||
section = XLFormSectionDescriptor()
|
||||
section.title = "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(tag: Tags.Date, rowType: XLFormRowDescriptorTypeDateInline, title:"Disabled")
|
||||
row.value = NSDate()
|
||||
section.addFormRow(row)
|
||||
row.disabled = NSPredicate(format: "$\(Tags.Text).value contains[c] 'disable' OR ($\(Tags.Integer).value between {18, 60}) OR ($\(Tags.Switch).value == 0)")
|
||||
section.hidden = NSPredicate(format: "($\(Tags.Text).value contains[c] 'disable') AND ($\(Tags.Integer).value between {18, 60}) AND ($\(Tags.Switch).value == 0)")
|
||||
|
||||
|
||||
|
||||
section = XLFormSectionDescriptor()
|
||||
section.title = "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.swift"
|
||||
form.addFormSection(section)
|
||||
|
||||
|
||||
|
||||
row = XLFormRowDescriptor(tag: "thirds", rowType:XLFormRowDescriptorTypeAccount, title:"Account")
|
||||
section.addFormRow(row)
|
||||
row.hidden = NSPredicate(format: "$\(Tags.Date).isDisabled == 1 AND $\(Tags.Text).value contains[c] 'Out'")
|
||||
|
||||
|
||||
row.onChangeBlock = { [weak self] oldValue, newValue, _ in
|
||||
let noValue = "No Value"
|
||||
let message = "Old value: \(oldValue ?? noValue), New value: \(newValue ?? noValue)"
|
||||
let alertView = UIAlertController(title: "Account Field changed", message: message, preferredStyle: .ActionSheet)
|
||||
alertView.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: nil))
|
||||
self?.navigationController?.presentViewController(alertView, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
self.form = form
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
//
|
||||
// NativeEventNavigationViewController.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 "XLForm.h"
|
||||
#import "DateAndTimeValueTrasformer.h"
|
||||
#import "NativeEventFormViewController.h"
|
||||
|
||||
|
||||
@implementation NativeEventNavigationViewController
|
||||
|
||||
-(id)init
|
||||
{
|
||||
self = [super initWithRootViewController:[[NativeEventFormViewController alloc] init]];
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
[self.view setTintColor:[UIColor redColor]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface NativeEventFormViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation NativeEventFormViewController
|
||||
|
||||
- (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:@"Add Event"];
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[form addFormSection:section];
|
||||
|
||||
// Title
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"Title" rowType:XLFormRowDescriptorTypeText];
|
||||
[row.cellConfigAtConfigure setObject:@"Title" forKey:@"textField.placeholder"];
|
||||
row.required = YES;
|
||||
[section addFormRow:row];
|
||||
|
||||
// Location
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"location" rowType:XLFormRowDescriptorTypeText];
|
||||
[row.cellConfigAtConfigure setObject:@"Location" forKey:@"textField.placeholder"];
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[form addFormSection:section];
|
||||
|
||||
// All-day
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"all-day" rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"All-day"];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Starts
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"starts" rowType:XLFormRowDescriptorTypeDateTimeInline title:@"Starts"];
|
||||
row.value = [NSDate dateWithTimeIntervalSinceNow:60*60*24];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Ends
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"ends" rowType:XLFormRowDescriptorTypeDateTimeInline title:@"Ends"];
|
||||
row.value = [NSDate dateWithTimeIntervalSinceNow:60*60*25];
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[form addFormSection:section];
|
||||
|
||||
// Repeat
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"repeat" rowType:XLFormRowDescriptorTypeSelectorPush title:@"Repeat"];
|
||||
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Never"];
|
||||
row.selectorTitle = @"Repeat";
|
||||
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Never"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Every Day"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Every Week"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Every 2 Weeks"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(4) displayText:@"Every Month"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(5) displayText:@"Every Year"],
|
||||
];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[form addFormSection:section];
|
||||
|
||||
// Alert
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"alert" rowType:XLFormRowDescriptorTypeSelectorPush title:@"Alert"];
|
||||
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"None"];
|
||||
row.selectorTitle = @"Event Alert";
|
||||
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"None"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"At time of event"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"5 minutes before"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"15 minutes before"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(4) displayText:@"30 minutes before"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(5) displayText:@"1 hour before"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(6) displayText:@"2 hours before"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(7) displayText:@"1 day before"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(8) displayText:@"2 days before"],
|
||||
];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[form addFormSection:section];
|
||||
|
||||
// Show As
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"showAs" rowType:XLFormRowDescriptorTypeSelectorPush title:@"Show As"];
|
||||
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Busy"];
|
||||
row.selectorTitle = @"Show As";
|
||||
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Busy"],
|
||||
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Free"]];
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[form addFormSection:section];
|
||||
|
||||
// URL
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"url" rowType:XLFormRowDescriptorTypeURL];
|
||||
[row.cellConfigAtConfigure setObject:@"URL" forKey:@"textField.placeholder"];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Notes
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"notes" rowType:XLFormRowDescriptorTypeTextView];
|
||||
[row.cellConfigAtConfigure setObject:@"Notes" forKey:@"textView.placeholder"];
|
||||
[section addFormRow:row];
|
||||
|
||||
|
||||
self.form = form;
|
||||
}
|
||||
|
||||
-(void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelPressed:)];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(savePressed:)];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - XLFormDescriptorDelegate
|
||||
|
||||
-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
|
||||
{
|
||||
[super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
|
||||
if ([rowDescriptor.tag isEqualToString:@"alert"]){
|
||||
if ([[rowDescriptor.value valueData] isEqualToNumber:@(0)] == NO && [[oldValue valueData] isEqualToNumber:@(0)]){
|
||||
|
||||
XLFormRowDescriptor * newRow = [rowDescriptor copy];
|
||||
newRow.tag = @"secondAlert";
|
||||
newRow.title = @"Second Alert";
|
||||
[self.form addFormRow:newRow afterRow:rowDescriptor];
|
||||
}
|
||||
else if ([[oldValue valueData] isEqualToNumber:@(0)] == NO && [[newValue valueData] isEqualToNumber:@(0)]){
|
||||
[self.form removeFormRowWithTag:@"secondAlert"];
|
||||
}
|
||||
}
|
||||
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];
|
||||
if ([[rowDescriptor.value valueData] boolValue] == YES){
|
||||
startDateDescriptor.valueTransformer = [DateValueTrasformer class];
|
||||
endDateDescriptor.valueTransformer = [DateValueTrasformer class];
|
||||
[dateStartCell setFormDatePickerMode:XLFormDateDatePickerModeDate];
|
||||
[dateEndCell setFormDatePickerMode:XLFormDateDatePickerModeDate];
|
||||
}
|
||||
else{
|
||||
startDateDescriptor.valueTransformer = [DateTimeValueTrasformer class];
|
||||
endDateDescriptor.valueTransformer = [DateTimeValueTrasformer class];
|
||||
[dateStartCell setFormDatePickerMode:XLFormDateDatePickerModeDateTime];
|
||||
[dateEndCell setFormDatePickerMode:XLFormDateDatePickerModeDateTime];
|
||||
}
|
||||
[dateStartCell update];
|
||||
[dateEndCell update];
|
||||
}
|
||||
else if ([rowDescriptor.tag isEqualToString:@"starts"]){
|
||||
XLFormRowDescriptor * startDateDescriptor = [self.form formRowWithTag:@"starts"];
|
||||
XLFormRowDescriptor * endDateDescriptor = [self.form formRowWithTag:@"ends"];
|
||||
XLFormDateCell * dateEndCell = (XLFormDateCell *)[endDateDescriptor cellForFormController:self];
|
||||
if ([startDateDescriptor.value compare:endDateDescriptor.value] == NSOrderedDescending) {
|
||||
// startDateDescriptor is later than endDateDescriptor
|
||||
endDateDescriptor.value = [[NSDate alloc] initWithTimeInterval:(60*60*24) sinceDate:startDateDescriptor.value];
|
||||
[dateEndCell update];
|
||||
}
|
||||
}
|
||||
else if ([rowDescriptor.tag isEqualToString:@"ends"]){
|
||||
XLFormRowDescriptor * startDateDescriptor = [self.form formRowWithTag:@"starts"];
|
||||
XLFormRowDescriptor * endDateDescriptor = [self.form formRowWithTag:@"ends"];
|
||||
XLFormDateCell * dateEndCell = (XLFormDateCell *)[endDateDescriptor cellForFormController:self];
|
||||
if ([startDateDescriptor.value compare:endDateDescriptor.value] == NSOrderedDescending) {
|
||||
// startDateDescriptor is later than endDateDescriptor
|
||||
NSDictionary *strikeThroughAttribute = [NSDictionary dictionaryWithObject:@1
|
||||
forKey:NSStrikethroughStyleAttributeName];
|
||||
NSAttributedString* strikeThroughText = [[NSAttributedString alloc] initWithString:dateEndCell.detailTextLabel.text attributes:strikeThroughAttribute];
|
||||
dateEndCell.detailTextLabel.attributedText = strikeThroughText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)cancelPressed:(UIBarButtonItem * __unused)button
|
||||
{
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
||||
-(void)savePressed:(UIBarButtonItem * __unused)button
|
||||
{
|
||||
NSArray * validationErrors = [self formValidationErrors];
|
||||
if (validationErrors.count > 0){
|
||||
[self showFormValidationError:[validationErrors firstObject]];
|
||||
return;
|
||||
}
|
||||
[self.tableView endEditing:YES];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// CustomSelectorsFormViewController.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 <MapKit/MapKit.h>
|
||||
#import "CLLocationValueTrasformer.h"
|
||||
#import "MapViewController.h"
|
||||
|
||||
#import "CustomSelectorsFormViewController.h"
|
||||
|
||||
NSString *const kSelectorMap = @"selectorMap";
|
||||
NSString *const kSelectorMapPopover = @"selectorMapPopover";
|
||||
|
||||
@implementation CustomSelectorsFormViewController
|
||||
|
||||
-(id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
XLFormDescriptor * form = [XLFormDescriptor formDescriptorWithTitle:@"Custom Selectors"];
|
||||
XLFormSectionDescriptor * section;
|
||||
XLFormRowDescriptor * row;
|
||||
|
||||
// Basic Information
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
section.footerTitle = @"CustomSelectorsFormViewController.h";
|
||||
[form addFormSection:section];
|
||||
|
||||
|
||||
// Selector Push
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorMap rowType:XLFormRowDescriptorTypeSelectorPush title:@"Coordinate"];
|
||||
row.action.viewControllerClass = [MapViewController class];
|
||||
row.valueTransformer = [CLLocationValueTrasformer class];
|
||||
row.value = [[CLLocation alloc] initWithLatitude:-33 longitude:-56];
|
||||
[section addFormRow:row];
|
||||
|
||||
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad){
|
||||
// Selector PopOver
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorMapPopover rowType:XLFormRowDescriptorTypeSelectorPopover title:@"Coordinate PopOver"];
|
||||
row.action.viewControllerClass = [MapViewController class];
|
||||
row.valueTransformer = [CLLocationValueTrasformer class];
|
||||
row.value = [[CLLocation alloc] initWithLatitude:-33 longitude:-56];
|
||||
[section addFormRow:row];
|
||||
}
|
||||
|
||||
self.form = form;
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||