Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e9de49db86 |
+4
-2
@@ -19,5 +19,7 @@ DerivedData
|
||||
|
||||
#CocoaPods
|
||||
Pods
|
||||
Podfile.lock
|
||||
*.xcworkspace
|
||||
Tests/Pods
|
||||
Tests/Podfile.lock
|
||||
Examples/Objective-C/Podfile.lock
|
||||
Examples/Swift/Podfile.lock
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
language: objective-c
|
||||
osx_image: xcode10.2
|
||||
osx_image: xcode8.2
|
||||
before_install:
|
||||
- gem install cocoapods --quiet
|
||||
- gem install xcpretty --quiet
|
||||
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
|
||||
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
|
||||
- cd Tests && pod install && cd $TRAVIS_BUILD_DIR
|
||||
script: rake test
|
||||
|
||||
|
||||
+1
-10
@@ -1,15 +1,6 @@
|
||||
# Change Log
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
### Version 4.0.1:
|
||||
* Memory improvements and fixes.
|
||||
* Other minor fixes
|
||||
|
||||
### Version 4.0.0:
|
||||
* Adds support for Xcode 9.
|
||||
* Deprecated UIAlertView, UIActionSheet, UIPopoverController.
|
||||
* Bumped minimum iOS version to 9.0.
|
||||
|
||||
### Version 3.3.0:
|
||||
* Added `cellConfigForSelector` to style XLFormOptionsViewController
|
||||
* Added properties to **limit number of characters** in `XLFormTextFieldCell` and `XLFormTextViewCell`
|
||||
@@ -143,4 +134,4 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
### Version 1.0.0
|
||||
|
||||
* Initial release
|
||||
* Initial release
|
||||
@@ -154,13 +154,38 @@ NSString *const kCountDownTimer = @"countDownTimer";
|
||||
|
||||
-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)formRow oldValue:(id)oldValue newValue:(id)newValue
|
||||
{
|
||||
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];
|
||||
// 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
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
// http://stackoverflow.com/questions/12580162/nsstring-to-nsdate-conversion-issue
|
||||
@interface CurrencyFormatter : NSNumberFormatter
|
||||
|
||||
@property (readonly, strong) NSDecimalNumberHandler *roundingBehavior;
|
||||
@property (readonly) NSDecimalNumberHandler *roundingBehavior;
|
||||
|
||||
@end
|
||||
|
||||
@@ -117,4 +117,4 @@
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
@@ -135,13 +135,33 @@ NSString *const kNotes = @"notes";
|
||||
}
|
||||
[self.tableView endEditing:YES];
|
||||
|
||||
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];
|
||||
#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
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#import "XLForm.h"
|
||||
#import "SelectorsFormViewController.h"
|
||||
#import "MultivaluedFormViewController.h"
|
||||
#import "MultiValuedFormViewController.h"
|
||||
|
||||
|
||||
@implementation MultivaluedFormViewController
|
||||
@@ -85,45 +85,95 @@
|
||||
|
||||
-(void)addDidTouch:(UIBarButtonItem * __unused)sender
|
||||
{
|
||||
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];
|
||||
#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
|
||||
{
|
||||
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 if (![[actionSheet buttonTitleAtIndex:buttonIndex] isEqualToString:NSLocalizedString(@"Cancel")]){
|
||||
self.form.disabled = !self.form.disabled;
|
||||
[self.tableView endEditing:YES];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
NSString *const kFormImageSelectorCellDefaultImage = @"defaultImage";
|
||||
NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
|
||||
|
||||
@interface XLFormImageSelectorCell() <UINavigationControllerDelegate, UIImagePickerControllerDelegate>
|
||||
@interface XLFormImageSelectorCell() <UIActionSheetDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate>
|
||||
|
||||
@property (nonatomic) UIImage * defaultImage;
|
||||
@property (nonatomic) NSURLRequest * imageRequest;
|
||||
@@ -92,36 +92,57 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
|
||||
|
||||
-(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller
|
||||
{
|
||||
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];
|
||||
#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
|
||||
@@ -192,6 +213,32 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
|
||||
[self.textLabel removeObserver:self forKeyPath:@"text"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
|
||||
|
||||
#pragma mark - UIActionSheetDelegate
|
||||
|
||||
- (void)actionSheet:(UIActionSheet * __unused)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||
{
|
||||
UIImagePickerController * imagePickerController = [[UIImagePickerController alloc] init];
|
||||
imagePickerController.delegate = self;
|
||||
imagePickerController.allowsEditing = YES;
|
||||
if (buttonIndex == 0){
|
||||
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
|
||||
imagePickerController.mediaTypes = @[(NSString *)kUTTypeImage];
|
||||
[self.formViewController presentViewController:imagePickerController animated:YES completion:nil];
|
||||
}
|
||||
else if (buttonIndex == 1){
|
||||
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
|
||||
imagePickerController.mediaTypes = @[(NSString *)kUTTypeImage];
|
||||
[self.formViewController presentViewController:imagePickerController animated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#pragma mark - UIImagePickerControllerDelegate
|
||||
|
||||
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
|
||||
|
||||
@@ -134,13 +134,32 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
__typeof(self) __weak weakSelf = self;
|
||||
buttonLeftAlignedRow.action.formBlock = ^(XLFormRowDescriptor * sender){
|
||||
if ([[sender.sectionDescriptor.formDescriptor formRowWithTag:kSwitchBool].value boolValue]){
|
||||
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];
|
||||
#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
|
||||
}
|
||||
[weakSelf deselectFormRow:sender];
|
||||
};
|
||||
@@ -177,13 +196,33 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
-(void)didTouchButton:(XLFormRowDescriptor *)sender
|
||||
{
|
||||
if ([[sender.sectionDescriptor.formDescriptor formRowWithTag:kSwitchBool].value boolValue]){
|
||||
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];
|
||||
#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];
|
||||
}
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@
|
||||
|
||||
MKPinAnnotationView *pinAnnotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation
|
||||
reuseIdentifier:@"annotation"];
|
||||
pinAnnotationView.pinTintColor = [UIColor redColor];
|
||||
pinAnnotationView.pinColor = MKPinAnnotationColorRed;
|
||||
pinAnnotationView.draggable = YES;
|
||||
pinAnnotationView.animatesDrop = YES;
|
||||
return pinAnnotationView;
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
#import "XLFormRowDescriptor.h"
|
||||
#import "XLRemoteDataStoreController.h"
|
||||
|
||||
@interface UsersTableViewController : XLRemoteDataStoreController <XLFormRowDescriptorViewController>
|
||||
@interface UsersTableViewController : XLRemoteDataStoreController <XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController>
|
||||
|
||||
@property BOOL isSearchResultsController;
|
||||
@property NSLayoutConstraint *topConstraint;
|
||||
|
||||
@end
|
||||
@end
|
||||
@@ -124,6 +124,7 @@
|
||||
|
||||
@implementation UsersTableViewController
|
||||
@synthesize rowDescriptor = _rowDescriptor;
|
||||
@synthesize popoverController = __popoverController;
|
||||
@synthesize searchController = _searchController;
|
||||
@synthesize searchResultController = _searchResultController;
|
||||
|
||||
@@ -204,16 +205,15 @@ static NSString *const kCellIdentifier = @"CellIdentifier";
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
NSDictionary *dataItem = [self.dataStore dataAtIndexPath:indexPath];
|
||||
|
||||
|
||||
self.rowDescriptor.value = dataItem;
|
||||
|
||||
UIViewController *popoverController = self.presentedViewController;
|
||||
if (popoverController && popoverController.modalPresentationStyle == UIModalPresentationPopover) {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
} else if ([self.parentViewController isKindOfClass:[UINavigationController class]]) {
|
||||
if (self.popoverController){
|
||||
[self.popoverController dismissPopoverAnimated:YES];
|
||||
[self.popoverController.delegate popoverControllerDidDismissPopover:self.popoverController];
|
||||
}
|
||||
else if ([self.parentViewController isKindOfClass:[UINavigationController class]]){
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
} else if ([self.presentingViewController isKindOfClass:[UsersTableViewController class]]) {
|
||||
[[self.presentingViewController navigationController] popViewControllerAnimated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,12 +243,10 @@ static NSString *const kCellIdentifier = @"CellIdentifier";
|
||||
-(UsersTableViewController *)searchResultController
|
||||
{
|
||||
if (_searchResultController) return _searchResultController;
|
||||
UsersTableViewController *usersViewController = [[UsersTableViewController alloc] init];
|
||||
usersViewController.rowDescriptor = self.rowDescriptor;
|
||||
_searchResultController = usersViewController;
|
||||
_searchResultController = [[UsersTableViewController alloc]init];
|
||||
_searchResultController.dataLoader.limit = 0; // no paging in search result
|
||||
_searchResultController.isSearchResultsController = YES;
|
||||
return _searchResultController;
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
@@ -1,5 +1,5 @@
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
platform :ios, '9.0'
|
||||
platform :ios, '8.0'
|
||||
|
||||
target 'XLForm' do
|
||||
|
||||
@@ -11,4 +11,4 @@ pod 'XLData', :git => 'https://github.com/xmartlabs/XLData.git', :commit => '1f9
|
||||
pod 'JVFloatLabeledTextField', '1.0.2', :inhibit_warnings => true
|
||||
pod 'AXRatingView', '1.0.3', :inhibit_warnings => true
|
||||
pod 'SHSPhoneComponent'
|
||||
end
|
||||
end
|
||||
@@ -43,7 +43,7 @@ PODS:
|
||||
- XLData/RemoteDataStore (2.0.0):
|
||||
- XLData/CoreRemote
|
||||
- XLData/DataStore
|
||||
- XLForm (4.0.1)
|
||||
- XLForm (3.1.2)
|
||||
|
||||
DEPENDENCIES:
|
||||
- AFNetworking (~> 2.0)
|
||||
@@ -53,19 +53,12 @@ DEPENDENCIES:
|
||||
- XLData (from `https://github.com/xmartlabs/XLData.git`, commit `1f9019b56242a2019c7f7e11ec4ef823c397ebcf`)
|
||||
- XLForm (from `../../`)
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/cocoapods/specs.git:
|
||||
- AFNetworking
|
||||
- AXRatingView
|
||||
- JVFloatLabeledTextField
|
||||
- SHSPhoneComponent
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
XLData:
|
||||
:commit: 1f9019b56242a2019c7f7e11ec4ef823c397ebcf
|
||||
:git: https://github.com/xmartlabs/XLData.git
|
||||
XLForm:
|
||||
:path: "../../"
|
||||
:path: ../../
|
||||
|
||||
CHECKOUT OPTIONS:
|
||||
XLData:
|
||||
@@ -78,8 +71,8 @@ SPEC CHECKSUMS:
|
||||
JVFloatLabeledTextField: 58a3a32cfb800e5b224f676987e7c13abf50a14d
|
||||
SHSPhoneComponent: 4cec0653a150ad63cbc52b0c8b29ce2d3c9c26f0
|
||||
XLData: df725c6179e2e0c80bf56a1ecad9afd169707a6d
|
||||
XLForm: b8d47a9a00fb6166981cb40de7169d70d611e9be
|
||||
XLForm: 6bb3c20857e2983cf494cb8b4d666c2a24673d5e
|
||||
|
||||
PODFILE CHECKSUM: 64fbcd03a2c13762b2c18e3938cc8008807937c9
|
||||
PODFILE CHECKSUM: 80615792e859be64c95add3bb57c1596234faf95
|
||||
|
||||
COCOAPODS: 1.6.0
|
||||
COCOAPODS: 1.0.0
|
||||
|
||||
@@ -482,11 +482,12 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 2850C62418D0F707002B7D0A /* Build configuration list for PBXNativeTarget "XLForm" */;
|
||||
buildPhases = (
|
||||
EBE0335CCC7588D83B89A92A /* [CP] Check Pods Manifest.lock */,
|
||||
EBE0335CCC7588D83B89A92A /* 📦 Check Pods Manifest.lock */,
|
||||
2850C5F418D0F706002B7D0A /* Sources */,
|
||||
2850C5F518D0F706002B7D0A /* Frameworks */,
|
||||
2850C5F618D0F706002B7D0A /* Resources */,
|
||||
DE3D12F5596780A66C6C3D4A /* [CP] Copy Pods Resources */,
|
||||
32EB30E0A90A4E91864B1D3C /* 📦 Embed Pods Frameworks */,
|
||||
DE3D12F5596780A66C6C3D4A /* 📦 Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -503,7 +504,7 @@
|
||||
2850C5F018D0F706002B7D0A /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0940;
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = Xmartlabs;
|
||||
};
|
||||
buildConfigurationList = 2850C5F318D0F706002B7D0A /* Build configuration list for PBXProject "XLForm" */;
|
||||
@@ -541,40 +542,49 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
DE3D12F5596780A66C6C3D4A /* [CP] Copy Pods Resources */ = {
|
||||
32EB30E0A90A4E91864B1D3C /* 📦 Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-XLForm/Pods-XLForm-resources.sh",
|
||||
"${PODS_ROOT}/../../../XLForm/XLForm.bundle",
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
name = "📦 Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/XLForm.bundle",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-XLForm/Pods-XLForm-resources.sh\"\n";
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-XLForm/Pods-XLForm-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
EBE0335CCC7588D83B89A92A /* [CP] Check Pods Manifest.lock */ = {
|
||||
DE3D12F5596780A66C6C3D4A /* 📦 Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
name = "📦 Copy Pods Resources";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-XLForm-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-XLForm/Pods-XLForm-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
EBE0335CCC7588D83B89A92A /* 📦 Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
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;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
@@ -648,32 +658,19 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
@@ -686,7 +683,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
@@ -700,38 +697,25 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
@@ -746,7 +730,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "XLForm/XLForm-Prefix.pch";
|
||||
INFOPLIST_FILE = "XLForm/XLForm-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -764,7 +748,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "XLForm/XLForm-Prefix.pch";
|
||||
INFOPLIST_FILE = "XLForm/XLForm-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
@@ -58,16 +48,6 @@
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
@@ -121,13 +101,8 @@
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "83.5x83.5",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "car",
|
||||
"size" : "120x120",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
@@ -167,15 +142,8 @@
|
||||
"size" : "44x44",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "appLauncher",
|
||||
"subtype" : "40mm"
|
||||
},
|
||||
{
|
||||
"size" : "50x50",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "appLauncher",
|
||||
"subtype" : "44mm"
|
||||
"role" : "longLook",
|
||||
"subtype" : "42mm"
|
||||
},
|
||||
{
|
||||
"size" : "86x86",
|
||||
@@ -190,30 +158,6 @@
|
||||
"scale" : "2x",
|
||||
"role" : "quickLook",
|
||||
"subtype" : "42mm"
|
||||
},
|
||||
{
|
||||
"size" : "108x108",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "quickLook",
|
||||
"subtype" : "44mm"
|
||||
},
|
||||
{
|
||||
"idiom" : "watch-marketing",
|
||||
"size" : "1024x1024",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "car",
|
||||
"size" : "120x120",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "44x44",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "longLook",
|
||||
"subtype" : "42mm"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
platform :ios, '9.0'
|
||||
platform :ios, '8.0'
|
||||
|
||||
target 'SwiftExample' do
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
28D8326C1AEC177E009E3B3F /* ValidationExamplesFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D8326B1AEC177E009E3B3F /* ValidationExamplesFormViewController.swift */; };
|
||||
28D8326F1AEC2D1B009E3B3F /* UICustomizationFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D8326E1AEC2D1B009E3B3F /* UICustomizationFormViewController.swift */; };
|
||||
28F490221AAFBBC600C8E0CC /* DatesFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28F490211AAFBBC600C8E0CC /* DatesFormViewController.swift */; };
|
||||
649437BA8D5B7C59BBDB7B92 /* libPods-SwiftExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E006C7F7FF8E967AA8661BC9 /* libPods-SwiftExample.a */; };
|
||||
BF01E92B1C21FF2800BDE045 /* InlineSegmentedCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF01E92A1C21FF2800BDE045 /* InlineSegmentedCell.swift */; };
|
||||
DD7B43598E698717584375E9 /* libPods-SwiftExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFB9BA3A82D5F6FE7CCE5A5 /* libPods-SwiftExample.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@@ -77,10 +77,10 @@
|
||||
28D8326B1AEC177E009E3B3F /* ValidationExamplesFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidationExamplesFormViewController.swift; sourceTree = "<group>"; };
|
||||
28D8326E1AEC2D1B009E3B3F /* UICustomizationFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICustomizationFormViewController.swift; sourceTree = "<group>"; };
|
||||
28F490211AAFBBC600C8E0CC /* DatesFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DatesFormViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
2EB9C638FC2450A0B9786D1E /* Pods-SwiftExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample.release.xcconfig"; sourceTree = "<group>"; };
|
||||
420D9BAB7B0D2AF9487DD060 /* Pods-SwiftExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
9CFB9BA3A82D5F6FE7CCE5A5 /* libPods-SwiftExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwiftExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BF01E92A1C21FF2800BDE045 /* InlineSegmentedCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = InlineSegmentedCell.swift; path = InlineSegmentedCell/InlineSegmentedCell.swift; sourceTree = "<group>"; };
|
||||
CD0A6F89B9CD5843CA297E52 /* Pods-SwiftExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample.release.xcconfig"; sourceTree = "<group>"; };
|
||||
E006C7F7FF8E967AA8661BC9 /* libPods-SwiftExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwiftExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F019783EE34BD17E2BA41467 /* Pods-SwiftExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -88,7 +88,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
649437BA8D5B7C59BBDB7B92 /* libPods-SwiftExample.a in Frameworks */,
|
||||
DD7B43598E698717584375E9 /* libPods-SwiftExample.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -100,8 +100,8 @@
|
||||
children = (
|
||||
2847A6A01AAF2679000A2ABE /* SwiftExample */,
|
||||
2847A69F1AAF2679000A2ABE /* Products */,
|
||||
E9F3DD7ACEF5AAF92FCE6E24 /* Pods */,
|
||||
3D93F92C6A8B49B82B452B67 /* Frameworks */,
|
||||
7A12A831117D9B4D152E0A51 /* Pods */,
|
||||
402AE3EC1FACD058DCF0A2D3 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -324,14 +324,23 @@
|
||||
path = SwiftExample/Dates;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
3D93F92C6A8B49B82B452B67 /* Frameworks */ = {
|
||||
402AE3EC1FACD058DCF0A2D3 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E006C7F7FF8E967AA8661BC9 /* libPods-SwiftExample.a */,
|
||||
9CFB9BA3A82D5F6FE7CCE5A5 /* libPods-SwiftExample.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7A12A831117D9B4D152E0A51 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
420D9BAB7B0D2AF9487DD060 /* Pods-SwiftExample.debug.xcconfig */,
|
||||
2EB9C638FC2450A0B9786D1E /* Pods-SwiftExample.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BF01E9291C21FEF700BDE045 /* Inline Segmented */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -340,15 +349,6 @@
|
||||
name = "Inline Segmented";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E9F3DD7ACEF5AAF92FCE6E24 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F019783EE34BD17E2BA41467 /* Pods-SwiftExample.debug.xcconfig */,
|
||||
CD0A6F89B9CD5843CA297E52 /* Pods-SwiftExample.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -356,12 +356,12 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 2847A6BD1AAF2679000A2ABE /* Build configuration list for PBXNativeTarget "SwiftExample" */;
|
||||
buildPhases = (
|
||||
89E8536C00EFF5D0377E1AE9 /* [CP] Check Pods Manifest.lock */,
|
||||
21FCE00817B1AE1029F382A4 /* 📦 Check Pods Manifest.lock */,
|
||||
2847A69A1AAF2679000A2ABE /* Sources */,
|
||||
2847A69B1AAF2679000A2ABE /* Frameworks */,
|
||||
2847A69C1AAF2679000A2ABE /* Resources */,
|
||||
9BD9BF77E99A8DF4A44D2DB8 /* [CP] Embed Pods Frameworks */,
|
||||
DC50100813F1902A0CFCE009 /* [CP] Copy Pods Resources */,
|
||||
A0F2DA95250A4C3E69515D96 /* 📦 Copy Pods Resources */,
|
||||
DCA1F7B1D7E04613B3E151C1 /* 📦 Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -380,12 +380,12 @@
|
||||
attributes = {
|
||||
LastSwiftMigration = 0700;
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0900;
|
||||
LastUpgradeCheck = 0800;
|
||||
ORGANIZATIONNAME = Xmartlabs;
|
||||
TargetAttributes = {
|
||||
2847A69D1AAF2679000A2ABE = {
|
||||
CreatedOnToolsVersion = 6.2;
|
||||
LastSwiftMigration = 0900;
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -423,32 +423,44 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
89E8536C00EFF5D0377E1AE9 /* [CP] Check Pods Manifest.lock */ = {
|
||||
21FCE00817B1AE1029F382A4 /* 📦 Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
name = "📦 Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-SwiftExample-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
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;
|
||||
};
|
||||
9BD9BF77E99A8DF4A44D2DB8 /* [CP] Embed Pods Frameworks */ = {
|
||||
A0F2DA95250A4C3E69515D96 /* 📦 Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
name = "📦 Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
DCA1F7B1D7E04613B3E151C1 /* 📦 Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -456,24 +468,6 @@
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
DC50100813F1902A0CFCE009 /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample-resources.sh",
|
||||
"${PODS_ROOT}/../../../XLForm/XLForm.bundle",
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
@@ -522,20 +516,14 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@@ -558,7 +546,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -575,20 +563,14 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@@ -604,7 +586,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
@@ -615,7 +597,7 @@
|
||||
};
|
||||
2847A6BE1AAF2679000A2ABE /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = F019783EE34BD17E2BA41467 /* Pods-SwiftExample.debug.xcconfig */;
|
||||
baseConfigurationReference = 420D9BAB7B0D2AF9487DD060 /* Pods-SwiftExample.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
||||
@@ -624,14 +606,13 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "SwiftExample/SwiftExample-Bridging-Header.h";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
2847A6BF1AAF2679000A2ABE /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = CD0A6F89B9CD5843CA297E52 /* Pods-SwiftExample.release.xcconfig */;
|
||||
baseConfigurationReference = 2EB9C638FC2450A0B9786D1E /* Pods-SwiftExample.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
||||
@@ -640,8 +621,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "SwiftExample/SwiftExample-Bridging-Header.h";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -17,9 +17,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
|
||||
// Declare custom rows
|
||||
XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeRate] = NSStringFromClass(XLFormRatingCell.self)
|
||||
XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeRate] = "XLFormRatingCell"
|
||||
XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeFloatLabeledTextField] = FloatLabeledTextFieldCell.self
|
||||
XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeWeekDays] = NSStringFromClass(XLFormWeekDaysCell.self)
|
||||
XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeWeekDays] = "XLFormWeekDaysCell"
|
||||
XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeSegmentedInline] = InlineSegmentedCell.self
|
||||
XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeSegmentedControl] = InlineSegmentedControl.self
|
||||
XLFormViewController.inlineRowDescriptorTypesForRowDescriptorTypes()[XLFormRowDescriptorTypeSegmentedInline] = XLFormRowDescriptorTypeSegmentedControl
|
||||
|
||||
+3
-3
@@ -35,8 +35,8 @@ class FloatLabeledTextFieldCell : XLFormBaseCell, UITextFieldDelegate {
|
||||
lazy var floatLabeledTextField: JVFloatLabeledTextField = {
|
||||
let result = JVFloatLabeledTextField(frame: CGRect.zero)
|
||||
result.translatesAutoresizingMaskIntoConstraints = false
|
||||
result.font = UIFont.systemFont(ofSize: FloatLabeledTextFieldCell.kFontSize)
|
||||
result.floatingLabel.font = .boldSystemFont(ofSize: FloatLabeledTextFieldCell.kFontSize)
|
||||
result.font = UIFont.systemFont(ofSize: kFontSize)
|
||||
result.floatingLabel.font = .boldSystemFont(ofSize: kFontSize)
|
||||
result.clearButtonMode = .whileEditing
|
||||
return result
|
||||
}()
|
||||
@@ -54,7 +54,7 @@ class FloatLabeledTextFieldCell : XLFormBaseCell, UITextFieldDelegate {
|
||||
override func update() {
|
||||
super.update()
|
||||
if let rowDescriptor = rowDescriptor {
|
||||
floatLabeledTextField.attributedPlaceholder = NSAttributedString(string: rowDescriptor.title ?? "" , attributes: [NSAttributedStringKey.foregroundColor: UIColor.lightGray])
|
||||
floatLabeledTextField.attributedPlaceholder = NSAttributedString(string: rowDescriptor.title ?? "" , attributes: [NSForegroundColorAttributeName: UIColor.lightGray])
|
||||
if let value = rowDescriptor.value {
|
||||
floatLabeledTextField.text = (value as AnyObject).displayText()
|
||||
}
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ class InlineSegmentedCell : XLFormBaseCell {
|
||||
|
||||
override func formDescriptorCellBecomeFirstResponder() -> Bool {
|
||||
if isFirstResponder {
|
||||
_ = resignFirstResponder()
|
||||
resignFirstResponder()
|
||||
return false
|
||||
}
|
||||
return becomeFirstResponder()
|
||||
@@ -108,7 +108,7 @@ class InlineSegmentedControl : XLFormBaseCell, XLFormInlineRowDescriptorCell {
|
||||
|
||||
//MARK: Actions
|
||||
|
||||
@objc func valueChanged() {
|
||||
func valueChanged() {
|
||||
inlineRowDescriptor!.value = inlineRowDescriptor!.selectorOptions![segmentedControl.selectedSegmentIndex]
|
||||
formViewController().updateFormRow(inlineRowDescriptor)
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class XLFormRatingCell : XLFormBaseCell {
|
||||
|
||||
//MARK: Events
|
||||
|
||||
@objc func rateChanged(_ ratingView : XLRatingView){
|
||||
func rateChanged(_ ratingView : XLRatingView){
|
||||
rowDescriptor!.value = ratingView.value
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ class XLFormWeekDaysCell : XLFormBaseCell {
|
||||
|
||||
// raise the image and push it right so it appears centered
|
||||
// above the text
|
||||
let titleSize : CGSize = (button.titleLabel!.text! as NSString).size(withAttributes: [NSAttributedStringKey.font: button.titleLabel!.font])
|
||||
let titleSize : CGSize = (button.titleLabel!.text! as NSString).size(attributes: [NSFontAttributeName: button.titleLabel!.font])
|
||||
button.imageEdgeInsets = UIEdgeInsetsMake(-(titleSize.height + spacing), 0.0, 0.0, -titleSize.width)
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class DatesFormViewController: XLFormViewController {
|
||||
}
|
||||
|
||||
|
||||
@objc func disableEnable(_ button : UIBarButtonItem){
|
||||
func disableEnable(_ button : UIBarButtonItem){
|
||||
form.isDisabled = !form.isDisabled
|
||||
button.title = form.isDisabled ? "Enable" : "Disable"
|
||||
tableView.endEditing(true)
|
||||
@@ -154,10 +154,8 @@ class DatesFormViewController: XLFormViewController {
|
||||
override func formRowDescriptorValueHasChanged(_ formRow: XLFormRowDescriptor!, oldValue: Any!, newValue: Any!) {
|
||||
super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
|
||||
if formRow.tag == Tags.DatePicker {
|
||||
let alert = UIAlertController(title: "DatePicker", message: "Values has changed!", preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
|
||||
|
||||
present(alert, animated: true, completion: nil)
|
||||
let alertView = UIAlertView(title: "DatePicker", message: "Value Has changed!", delegate: self, cancelButtonTitle: "OK")
|
||||
alertView.show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,8 +131,12 @@ class User: NSObject, XLFormOptionObject {
|
||||
|
||||
}
|
||||
|
||||
class UsersTableViewController : UITableViewController, XLFormRowDescriptorViewController {
|
||||
class UsersTableViewController : UITableViewController, XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController {
|
||||
|
||||
|
||||
var rowDescriptor : XLFormRowDescriptor?
|
||||
var popoverController : UIPopoverController?
|
||||
|
||||
var userCell : UserCell?
|
||||
|
||||
fileprivate let kUserCellIdentifier = "UserCell"
|
||||
@@ -193,9 +197,9 @@ class UsersTableViewController : UITableViewController, XLFormRowDescriptorViewC
|
||||
let userData = usersData[(indexPath as NSIndexPath).row] as Dictionary<String, AnyObject>
|
||||
let user = User(userId: (userData["id"] as! Int), userName: userData["name"] as! String, userImage: userData["imageName"] as! String)
|
||||
self.rowDescriptor!.value = user;
|
||||
|
||||
if let popOver = self.presentedViewController, popOver.modalPresentationStyle == .popover {
|
||||
dismiss(animated: true, completion: nil)
|
||||
if let porpOver = self.popoverController {
|
||||
porpOver.dismiss(animated: true)
|
||||
porpOver.delegate?.popoverControllerDidDismissPopover!(porpOver)
|
||||
}
|
||||
else if parent is UINavigationController {
|
||||
navigationController?.popViewController(animated: true)
|
||||
|
||||
@@ -137,7 +137,7 @@ class InputsFormViewController : XLFormViewController {
|
||||
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .save, target: self, action: #selector(InputsFormViewController.savePressed(_:)))
|
||||
}
|
||||
|
||||
@objc func savePressed(_ button: UIBarButtonItem)
|
||||
func savePressed(_ button: UIBarButtonItem)
|
||||
{
|
||||
let validationErrors : Array<NSError> = self.formValidationErrors() as! Array<NSError>
|
||||
if (validationErrors.count > 0){
|
||||
@@ -145,11 +145,8 @@ class InputsFormViewController : XLFormViewController {
|
||||
return
|
||||
}
|
||||
self.tableView.endEditing(true)
|
||||
|
||||
let alert = UIAlertController(title: "Valid Form", message: "No errors found!", preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
|
||||
|
||||
present(alert, animated: true, completion: nil)
|
||||
let alertView = UIAlertView(title: "Valid Form", message: "No errors found", delegate: self, cancelButtonTitle: "OK")
|
||||
alertView.show()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+27
-30
@@ -83,45 +83,42 @@ class MultivaluedFormViewController : XLFormViewController {
|
||||
|
||||
//MARK: - Actions
|
||||
|
||||
@objc func addDidTouch(_ sender: UIBarButtonItem) {
|
||||
let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
||||
|
||||
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
|
||||
let removeAction = UIAlertAction(title: "Remove Last Section", style: .destructive, handler: { [weak self] alert in
|
||||
guard let `self` = self else { return }
|
||||
|
||||
if self.form.formSections.count > 0 {
|
||||
func addDidTouch(_ sender: UIBarButtonItem) {
|
||||
let actionSheet = UIActionSheet(title: nil, delegate: self, cancelButtonTitle: "Cancel", destructiveButtonTitle: "Remove Last Section", otherButtonTitles: "Add a section at the end", self.form!.isDisabled ? "Enable Form" : "Disable Form")
|
||||
actionSheet.show(in: view)
|
||||
}
|
||||
|
||||
//MARK: - UIActionSheetDelegate
|
||||
|
||||
|
||||
override func actionSheet(_ actionSheet: UIActionSheet, clickedButtonAt buttonIndex: Int) {
|
||||
if actionSheet.destructiveButtonIndex == buttonIndex {
|
||||
if form.formSections.count > 0 {
|
||||
// remove last section
|
||||
self.form.removeFormSection(at: UInt(self.form.formSections.count - 1))
|
||||
form.removeFormSection(at: UInt(form.formSections.count - 1))
|
||||
}
|
||||
})
|
||||
let addSectionAction = UIAlertAction(title: "Add a section at the end", style: .default, handler: { [weak self] alert in
|
||||
guard let `self` = self else { return }
|
||||
|
||||
}
|
||||
else if actionSheet.buttonTitle(at: buttonIndex) == "Add a section at the end" {
|
||||
// add a new section
|
||||
// let dateString = NSDateFormatter.localizedStringFromDate(NSDate(), dateStyle: NSDateFormatterStyle.ShortStyle, timeStyle: NSDateFormatterStyle.ShortStyle)
|
||||
let newSection = XLFormSectionDescriptor.formSection(withTitle: "Section created at \(DateFormatter.localizedString(from: Date(), dateStyle: DateFormatter.Style.short, timeStyle: DateFormatter.Style.short))", sectionOptions:XLFormSectionOptions.canInsert.union(.canDelete))
|
||||
newSection.multivaluedTag = "multivaluedPushSelector_\(self.form.formSections.count)"
|
||||
let newRow = XLFormRowDescriptor(tag: nil, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Tap to select )..")
|
||||
newRow.selectorOptions = ["Option 1", "Option 2", "Option 3"]
|
||||
newSection.addFormRow(newRow)
|
||||
self.form.addFormSection(newSection)
|
||||
})
|
||||
let toggleAction = UIAlertAction(title: self.form!.isDisabled ? "Enable Form" : "Disable Form", style: .default, handler: { [weak self] alert in
|
||||
guard let `self` = self else { return }
|
||||
|
||||
self.form.isDisabled = !self.form.isDisabled
|
||||
self.tableView.endEditing(true)
|
||||
self.tableView.reloadData()
|
||||
})
|
||||
|
||||
actionSheet.addAction(addSectionAction)
|
||||
actionSheet.addAction(removeAction)
|
||||
actionSheet.addAction(cancelAction)
|
||||
actionSheet.addAction(toggleAction)
|
||||
|
||||
present(actionSheet, animated: true, completion: nil)
|
||||
form.addFormSection(newSection)
|
||||
}
|
||||
else {
|
||||
form.isDisabled = !self.form.isDisabled
|
||||
tableView.endEditing(true)
|
||||
tableView.reloadData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class MultivaluedOnlyReorderViewController : XLFormViewController {
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
@@ -248,7 +245,7 @@ class MultivaluedOnlyDeleteViewController : XLFormViewController {
|
||||
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Editing", style: .plain, target: self, action: #selector(MultivaluedOnlyDeleteViewController.toggleEditing(_:)))
|
||||
}
|
||||
|
||||
@objc func toggleEditing(_ sender : UIBarButtonItem) {
|
||||
func toggleEditing(_ sender : UIBarButtonItem) {
|
||||
tableView.setEditing(!tableView.isEditing, animated: true)
|
||||
sender.title = tableView.isEditing ? "Editing" : "Not Editing"
|
||||
}
|
||||
|
||||
@@ -126,10 +126,8 @@ class OthersFormViewController : XLFormViewController {
|
||||
row.action.formBlock = { [weak self] (sender: XLFormRowDescriptor!) -> Void in
|
||||
let switchRow = sender.sectionDescriptor.formDescriptor!.formRow(withTag: Tags.SwitchBool)!
|
||||
if let value = switchRow.value , (value as AnyObject).boolValue == true {
|
||||
let alert = UIAlertController(title: "Switch is ON", message: "Button has checked the switch value...", preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
|
||||
|
||||
self?.present(alert, animated: true, completion: nil)
|
||||
let alertView = UIAlertView(title: "Switch is ON", message: "Button has checked the switch value...", delegate: self, cancelButtonTitle: "OK")
|
||||
alertView.show()
|
||||
}
|
||||
self?.deselectFormRow(sender)
|
||||
}
|
||||
@@ -166,12 +164,10 @@ class OthersFormViewController : XLFormViewController {
|
||||
self.form = form
|
||||
}
|
||||
|
||||
@objc func didTouchButton(_ sender: XLFormRowDescriptor) {
|
||||
func didTouchButton(_ sender: XLFormRowDescriptor) {
|
||||
if (sender.sectionDescriptor.formDescriptor.formRow(withTag: Tags.SwitchBool)?.value as AnyObject).boolValue == true{
|
||||
let alert = UIAlertController(title: "Switch is ON", message: "Button has checked the switch value...", preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
|
||||
|
||||
present(alert, animated: true, completion: nil)
|
||||
let alertView = UIAlertView(title: "Switch is ON", message: "Button has checked the switch value...", delegate: self, cancelButtonTitle: "OK")
|
||||
alertView.show()
|
||||
}
|
||||
self.deselectFormRow(sender)
|
||||
}
|
||||
@@ -187,7 +183,7 @@ class OthersFormViewController : XLFormViewController {
|
||||
}
|
||||
|
||||
|
||||
@objc func disableEnable(_ button : UIBarButtonItem) {
|
||||
func disableEnable(_ button : UIBarButtonItem) {
|
||||
form.isDisabled = !form.isDisabled
|
||||
button.title = form.isDisabled ? "Enable" : "Disable"
|
||||
tableView.endEditing(true)
|
||||
|
||||
@@ -197,7 +197,7 @@ class NativeEventFormViewController : XLFormViewController {
|
||||
// startDateDescriptor is later than endDateDescriptor
|
||||
dateEndCell.update()
|
||||
let newDetailText = dateEndCell.detailTextLabel!.text!
|
||||
let strikeThroughAttribute = [NSAttributedStringKey.strikethroughStyle : NSUnderlineStyle.styleSingle.rawValue]
|
||||
let strikeThroughAttribute = [NSStrikethroughStyleAttributeName : NSUnderlineStyle.styleSingle.rawValue]
|
||||
let strikeThroughText = NSAttributedString(string: newDetailText, attributes: strikeThroughAttribute)
|
||||
endDateDescriptor.cellConfig["detailTextLabel.attributedText"] = strikeThroughText
|
||||
updateFormRow(endDateDescriptor)
|
||||
@@ -210,12 +210,12 @@ class NativeEventFormViewController : XLFormViewController {
|
||||
}
|
||||
}
|
||||
|
||||
@objc func cancelPressed(_ button: UIBarButtonItem){
|
||||
func cancelPressed(_ button: UIBarButtonItem){
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
|
||||
@objc func savePressed(_ button: UIBarButtonItem){
|
||||
func savePressed(_ button: UIBarButtonItem){
|
||||
let validationErrors : Array<NSError> = formValidationErrors() as! Array<NSError>
|
||||
if (validationErrors.count > 0){
|
||||
showFormValidationError(validationErrors.first)
|
||||
|
||||
@@ -107,7 +107,7 @@ class SelectorsFormViewController : XLFormViewController {
|
||||
navigationItem.rightBarButtonItem = barButton
|
||||
}
|
||||
|
||||
@objc func disableEnable(_ button : UIBarButtonItem)
|
||||
func disableEnable(_ button : UIBarButtonItem)
|
||||
{
|
||||
form.isDisabled = !form.isDisabled
|
||||
button.title = form.isDisabled ? "Enable" : "Disable"
|
||||
|
||||
@@ -118,7 +118,7 @@ class ValidationExamplesFormViewController : XLFormViewController {
|
||||
|
||||
//MARK: Actions
|
||||
|
||||
@objc func validateForm(_ buttonItem: UIBarButtonItem) {
|
||||
func validateForm(_ buttonItem: UIBarButtonItem) {
|
||||
let array = formValidationErrors()
|
||||
for errorItem in array! {
|
||||
let error = errorItem as! NSError
|
||||
|
||||
@@ -6,9 +6,7 @@ By [XMARTLABS](http://xmartlabs.com).
|
||||
[](https://travis-ci.org/xmartlabs/XLForm)
|
||||
<a href="https://cocoapods.org/pods/XLForm"><img src="https://img.shields.io/cocoapods/v/XLForm.svg" alt="CocoaPods compatible" /></a>
|
||||
|
||||
**If you are working in Swift then you should have a look at [Eureka], a complete re-design of XLForm in Swift and with more features.**
|
||||
|
||||
We are not implementing any new features for XLForm anymore. However, if a critical issue arises we will fix it.
|
||||
**If you are working in Swift then you should have a look at [Eureka], a complete re-design of XLForm in Swift.** *Do not panic, we will continue maintaining and improving XLForm, obj-c rocks!!*
|
||||
|
||||
Purpose
|
||||
--------------
|
||||
@@ -1128,7 +1126,7 @@ Installation
|
||||
## CocoaPods
|
||||
|
||||
1. Add the following line in the project's Podfile file:
|
||||
`pod 'XLForm', '~> 4.0'`.
|
||||
`pod 'XLForm', '~> 3.0'`.
|
||||
2. Run the command `pod install` from the Podfile folder directory.
|
||||
|
||||
XLForm **has no** dependencies over other pods.
|
||||
@@ -1158,7 +1156,7 @@ For further details on how to create and configure the bridging header file visi
|
||||
In your `Cartfile` add:
|
||||
|
||||
```
|
||||
github "xmartlabs/XLForm" ~> 4.0
|
||||
github "xmartlabs/XLForm" ~> 3.0
|
||||
```
|
||||
|
||||
## Using git submodules
|
||||
@@ -1181,8 +1179,8 @@ Requirements
|
||||
-----------------------------
|
||||
|
||||
* ARC
|
||||
* iOS 9.0 and above
|
||||
* XCode 9.0+
|
||||
* iOS 7.0 and above
|
||||
* XCode 6.3+
|
||||
|
||||
|
||||
Release Notes
|
||||
|
||||
@@ -3,7 +3,7 @@ include FileUtils::Verbose
|
||||
namespace :test do
|
||||
desc "Run the XLForm Tests"
|
||||
task :ios do
|
||||
run_tests('XLForm Tests', 'iphonesimulator12.2')
|
||||
run_tests('XLForm Tests', 'iphonesimulator10.2')
|
||||
tests_failed unless $?.success?
|
||||
end
|
||||
end
|
||||
@@ -17,7 +17,7 @@ task :default => 'test'
|
||||
private
|
||||
|
||||
def run_tests(scheme, sdk)
|
||||
sh("xcodebuild -workspace 'Tests/XLForm Tests.xcworkspace' -scheme '#{scheme}' -sdk '#{sdk}' -destination 'OS=12.2,name=iPhone 8' -configuration Release clean test | xcpretty -c ; exit ${PIPESTATUS[0]}") rescue nil
|
||||
sh("xcodebuild -workspace 'Tests/XLForm Tests.xcworkspace' -scheme '#{scheme}' -sdk '#{sdk}' -destination 'OS=10.1,name=iPhone 7' -configuration Release clean test | xcpretty -c ; exit ${PIPESTATUS[0]}") rescue nil
|
||||
end
|
||||
|
||||
def tests_failed
|
||||
|
||||
+2
-3
@@ -2,9 +2,8 @@ source 'https://github.com/CocoaPods/Specs.git'
|
||||
project 'XLForm Tests'
|
||||
inhibit_all_warnings!
|
||||
|
||||
platform :ios, '9.0'
|
||||
|
||||
platform :ios, '7.0'
|
||||
target 'XLForm Tests' do
|
||||
pod 'Expecta', '~> 1.0'
|
||||
pod 'Expecta', '~> 0.3.0'
|
||||
pod 'XLForm', :path => '../'
|
||||
end
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
03885A911D7DD3BD00CC183A /* XLTestTextFieldProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = 03885A901D7DD3BD00CC183A /* XLTestTextFieldProperties.m */; };
|
||||
17538872B9BB29167787CF50 /* libPods-XLForm Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E68572C5C8328F0F177BBCA1 /* libPods-XLForm Tests.a */; };
|
||||
28657A3E1990879200CE8180 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28657A3D1990879200CE8180 /* XCTest.framework */; };
|
||||
28657A401990879200CE8180 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28657A3F1990879200CE8180 /* Foundation.framework */; };
|
||||
28657A421990879200CE8180 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28657A411990879200CE8180 /* UIKit.framework */; };
|
||||
28657A481990879200CE8180 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 28657A461990879200CE8180 /* InfoPlist.strings */; };
|
||||
28657A5219914F9700CE8180 /* XLTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 28657A5119914F9700CE8180 /* XLTestCase.m */; };
|
||||
28657A54199154EE00CE8180 /* XLFormValidatorsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 28657A53199154EE00CE8180 /* XLFormValidatorsTests.m */; };
|
||||
39585558ED414BFBE6FFB93C /* libPods-XLForm Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8189C74AF1BF64FDF4D14AE3 /* libPods-XLForm Tests.a */; };
|
||||
3C5B9B7A1AC0BA33000AF1BA /* XLFormExampleTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C5B9B791AC0BA33000AF1BA /* XLFormExampleTest.m */; };
|
||||
3C9817861AC30616003F6ABD /* UITextField+Test.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9817851AC30616003F6ABD /* UITextField+Test.m */; };
|
||||
6233D65F1D7DF022000E7716 /* XLTestTextViewProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = 6233D65E1D7DF022000E7716 /* XLTestTextViewProperties.m */; };
|
||||
@@ -33,14 +33,17 @@
|
||||
28657A5019914F9700CE8180 /* XLTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLTestCase.h; path = Test/XLTestCase.h; sourceTree = "<group>"; };
|
||||
28657A5119914F9700CE8180 /* XLTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLTestCase.m; path = Test/XLTestCase.m; sourceTree = "<group>"; };
|
||||
28657A53199154EE00CE8180 /* XLFormValidatorsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLFormValidatorsTests.m; path = Test/XLFormValidatorsTests.m; sourceTree = "<group>"; };
|
||||
35038A584FCFD0693D23F189 /* Pods-XLForm Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XLForm Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
3BE0FA85B15844909EF36AB4 /* Pods-XLForm Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XLForm Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
3C5B9B791AC0BA33000AF1BA /* XLFormExampleTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLFormExampleTest.m; path = Test/XLFormExampleTest.m; sourceTree = "<group>"; };
|
||||
3C9817841AC30616003F6ABD /* UITextField+Test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UITextField+Test.h"; path = "Helpers/UITextField+Test.h"; sourceTree = "<group>"; };
|
||||
3C9817851AC30616003F6ABD /* UITextField+Test.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UITextField+Test.m"; path = "Helpers/UITextField+Test.m"; sourceTree = "<group>"; };
|
||||
6233D65E1D7DF022000E7716 /* XLTestTextViewProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLTestTextViewProperties.m; path = Test/XLTestTextViewProperties.m; sourceTree = "<group>"; };
|
||||
8189C74AF1BF64FDF4D14AE3 /* libPods-XLForm Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-XLForm Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8ADC094C94CA7ABBB8134573 /* 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>"; };
|
||||
BFD111831AD8323900943D23 /* XLTestHideAndShow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLTestHideAndShow.m; path = Test/XLTestHideAndShow.m; sourceTree = "<group>"; };
|
||||
D5A9B3DB06904B24F1A8EA24 /* Pods-XLForm Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XLForm Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
F9D7EFDB6BD5884E5923B6AC /* Pods-XLForm Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XLForm Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
C6B20EA1A9D9591335BEE81F /* 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>"; };
|
||||
CEC7E8601D7342BFAF4C4060 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E68572C5C8328F0F177BBCA1 /* libPods-XLForm Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-XLForm Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -51,29 +54,20 @@
|
||||
28657A3E1990879200CE8180 /* XCTest.framework in Frameworks */,
|
||||
28657A421990879200CE8180 /* UIKit.framework in Frameworks */,
|
||||
28657A401990879200CE8180 /* Foundation.framework in Frameworks */,
|
||||
39585558ED414BFBE6FFB93C /* libPods-XLForm Tests.a in Frameworks */,
|
||||
17538872B9BB29167787CF50 /* libPods-XLForm Tests.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
142BA587E51B2D88244F04F1 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F9D7EFDB6BD5884E5923B6AC /* Pods-XLForm Tests.debug.xcconfig */,
|
||||
D5A9B3DB06904B24F1A8EA24 /* Pods-XLForm Tests.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
28657A2F19907FBE00CE8180 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
28657A431990879200CE8180 /* XLForm Tests */,
|
||||
28657A3C1990879200CE8180 /* Frameworks */,
|
||||
28657A3B1990879200CE8180 /* Products */,
|
||||
142BA587E51B2D88244F04F1 /* Pods */,
|
||||
52B313F2682BC45F8E9E8132 /* Pods */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -91,7 +85,8 @@
|
||||
28657A3D1990879200CE8180 /* XCTest.framework */,
|
||||
28657A3F1990879200CE8180 /* Foundation.framework */,
|
||||
28657A411990879200CE8180 /* UIKit.framework */,
|
||||
8189C74AF1BF64FDF4D14AE3 /* libPods-XLForm Tests.a */,
|
||||
CEC7E8601D7342BFAF4C4060 /* libPods.a */,
|
||||
E68572C5C8328F0F177BBCA1 /* libPods-XLForm Tests.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
@@ -139,6 +134,17 @@
|
||||
name = Helpers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
52B313F2682BC45F8E9E8132 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C6B20EA1A9D9591335BEE81F /* Pods.debug.xcconfig */,
|
||||
8ADC094C94CA7ABBB8134573 /* Pods.release.xcconfig */,
|
||||
35038A584FCFD0693D23F189 /* Pods-XLForm Tests.debug.xcconfig */,
|
||||
3BE0FA85B15844909EF36AB4 /* Pods-XLForm Tests.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -146,11 +152,12 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 28657A4C1990879200CE8180 /* Build configuration list for PBXNativeTarget "XLForm Tests" */;
|
||||
buildPhases = (
|
||||
29CB07B4E0344AEB95FE5406 /* [CP] Check Pods Manifest.lock */,
|
||||
6B058765CC1143829C6943B9 /* [CP] Check Pods Manifest.lock */,
|
||||
28657A361990879200CE8180 /* Sources */,
|
||||
28657A371990879200CE8180 /* Frameworks */,
|
||||
28657A381990879200CE8180 /* Resources */,
|
||||
7E96395A3A94BDD9487AE471 /* [CP] Copy Pods Resources */,
|
||||
3E5FCF05A57F40C6AF367F6D /* [CP] Copy Pods Resources */,
|
||||
6A2C507B76209618EDA57426 /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -167,7 +174,7 @@
|
||||
28657A3019907FBE00CE8180 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0900;
|
||||
LastUpgradeCheck = 0610;
|
||||
};
|
||||
buildConfigurationList = 28657A3319907FBE00CE8180 /* Build configuration list for PBXProject "XLForm Tests" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
@@ -198,40 +205,49 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
29CB07B4E0344AEB95FE5406 /* [CP] Check Pods Manifest.lock */ = {
|
||||
3E5FCF05A57F40C6AF367F6D /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-XLForm Tests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
7E96395A3A94BDD9487AE471 /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests-resources.sh",
|
||||
"${PODS_ROOT}/../../XLForm/XLForm.bundle",
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/XLForm.bundle",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests-resources.sh\"\n";
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
6A2C507B76209618EDA57426 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
6B058765CC1143829C6943B9 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
@@ -268,31 +284,6 @@
|
||||
28657A3419907FBE00CE8180 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -300,36 +291,12 @@
|
||||
28657A3519907FBE00CE8180 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
28657A4D1990879200CE8180 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = F9D7EFDB6BD5884E5923B6AC /* Pods-XLForm Tests.debug.xcconfig */;
|
||||
baseConfigurationReference = 35038A584FCFD0693D23F189 /* Pods-XLForm Tests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
@@ -367,10 +334,9 @@
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = "XLForm Tests/XLForm Tests-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
WRAPPER_EXTENSION = xctest;
|
||||
@@ -379,7 +345,7 @@
|
||||
};
|
||||
28657A4E1990879200CE8180 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D5A9B3DB06904B24F1A8EA24 /* Pods-XLForm Tests.release.xcconfig */;
|
||||
baseConfigurationReference = 3BE0FA85B15844909EF36AB4 /* Pods-XLForm Tests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
@@ -411,9 +377,8 @@
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = "XLForm Tests/XLForm Tests-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
LastUpgradeVersion = "0610"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -23,11 +23,10 @@
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
@@ -40,19 +39,15 @@
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
@@ -67,10 +62,10 @@
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<string>com.xmartlabs.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'XLForm'
|
||||
s.version = '4.0.1'
|
||||
s.version = '3.3.0'
|
||||
s.license = { :type => 'MIT' }
|
||||
s.summary = 'XLForm is the most flexible and powerful iOS library to create dynamic table-view forms.'
|
||||
s.description = <<-DESC
|
||||
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
||||
s.source = { :git => 'https://github.com/xmartlabs/XLForm.git', :tag => s.version }
|
||||
s.source_files = 'XLForm/XL/**/*.{h,m}'
|
||||
s.requires_arc = true
|
||||
s.ios.deployment_target = '9.0'
|
||||
s.ios.deployment_target = '7.0'
|
||||
s.ios.frameworks = 'UIKit', 'Foundation', 'CoreGraphics'
|
||||
s.resource = 'XLForm/XLForm.bundle'
|
||||
end
|
||||
|
||||
@@ -414,7 +414,7 @@
|
||||
E267FD171BE8048900F86B42 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0940;
|
||||
LastUpgradeCheck = 0710;
|
||||
ORGANIZATIONNAME = XLForm;
|
||||
TargetAttributes = {
|
||||
E267FD1F1BE8048900F86B42 = {
|
||||
@@ -505,23 +505,13 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
@@ -544,7 +534,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -562,23 +552,13 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
@@ -595,7 +575,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -608,7 +588,6 @@
|
||||
E267FD291BE8048900F86B42 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
@@ -625,7 +604,6 @@
|
||||
E267FD2A1BE8048900F86B42 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0940"
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
|
||||
@protocol XLFormReturnKeyProtocol
|
||||
|
||||
@property (nonatomic, assign) UIReturnKeyType returnKeyType;
|
||||
@property (nonatomic, assign) UIReturnKeyType nextReturnKeyType;
|
||||
@property UIReturnKeyType returnKeyType;
|
||||
@property UIReturnKeyType nextReturnKeyType;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -34,10 +34,10 @@ typedef NS_ENUM(NSUInteger, XLFormDateDatePickerMode) {
|
||||
|
||||
@interface XLFormDateCell : XLFormBaseCell
|
||||
|
||||
@property (nonatomic, assign) XLFormDateDatePickerMode formDatePickerMode;
|
||||
@property (nonatomic, copy ) NSDate *minimumDate;
|
||||
@property (nonatomic, copy ) NSDate *maximumDate;
|
||||
@property (nonatomic, assign) NSInteger minuteInterval;
|
||||
@property (nonatomic, copy ) NSLocale *locale;
|
||||
@property (nonatomic) XLFormDateDatePickerMode formDatePickerMode;
|
||||
@property (nonatomic) NSDate *minimumDate;
|
||||
@property (nonatomic) NSDate *maximumDate;
|
||||
@property (nonatomic) NSInteger minuteInterval;
|
||||
@property (nonatomic) NSLocale *locale;
|
||||
|
||||
@end
|
||||
|
||||
@@ -37,6 +37,16 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
-(UIDatePicker *)datePicker
|
||||
{
|
||||
if (_datePicker) return _datePicker;
|
||||
_datePicker = [UIDatePicker autolayoutView];
|
||||
[_datePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged];
|
||||
return _datePicker;
|
||||
}
|
||||
|
||||
#pragma mark- Target Action
|
||||
|
||||
- (void)datePickerValueChanged:(UIDatePicker *)sender
|
||||
@@ -56,12 +66,7 @@
|
||||
-(void)configure
|
||||
{
|
||||
[super configure];
|
||||
|
||||
UIDatePicker *datePicker = [UIDatePicker autolayoutView];
|
||||
[datePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged];
|
||||
[self.contentView addSubview:datePicker];
|
||||
_datePicker = datePicker;
|
||||
|
||||
[self.contentView addSubview:self.datePicker];
|
||||
[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.datePicker attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]];
|
||||
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[datePicker]-0-|" options:0 metrics:0 views:@{@"datePicker" : self.datePicker}]];
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
@interface XLFormImageCell() <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
|
||||
{
|
||||
UIPopoverController *popoverController;
|
||||
UIImagePickerController *imagePickerController;
|
||||
UIAlertController *alertController;
|
||||
}
|
||||
@@ -71,7 +72,6 @@
|
||||
|
||||
- (void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller
|
||||
{
|
||||
__weak typeof(self) weak = self;
|
||||
alertController = [UIAlertController alertControllerWithTitle: self.rowDescriptor.title
|
||||
message: nil
|
||||
preferredStyle: UIAlertControllerStyleActionSheet];
|
||||
@@ -79,14 +79,14 @@
|
||||
[alertController addAction:[UIAlertAction actionWithTitle: NSLocalizedString(@"Choose From Library", nil)
|
||||
style: UIAlertActionStyleDefault
|
||||
handler: ^(UIAlertAction * _Nonnull action) {
|
||||
[weak openImage:UIImagePickerControllerSourceTypePhotoLibrary];
|
||||
[self openImage:UIImagePickerControllerSourceTypePhotoLibrary];
|
||||
}]];
|
||||
|
||||
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
|
||||
[alertController addAction:[UIAlertAction actionWithTitle: NSLocalizedString(@"Take Photo", nil)
|
||||
style: UIAlertActionStyleDefault
|
||||
handler: ^(UIAlertAction * _Nonnull action) {
|
||||
[weak openImage:UIImagePickerControllerSourceTypeCamera];
|
||||
[self openImage:UIImagePickerControllerSourceTypeCamera];
|
||||
}]];
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[weak.formViewController presentViewController:self->alertController animated: true completion: nil];
|
||||
[self.formViewController presentViewController:alertController animated: true completion: nil];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -113,15 +113,16 @@
|
||||
imagePickerController.sourceType = source;
|
||||
|
||||
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
||||
imagePickerController.modalPresentationStyle = UIModalPresentationPopover;
|
||||
imagePickerController.popoverPresentationController.sourceRect = self.contentView.frame;
|
||||
imagePickerController.popoverPresentationController.sourceView = self.formViewController.view;
|
||||
imagePickerController.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
|
||||
popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];
|
||||
[popoverController presentPopoverFromRect: self.contentView.frame
|
||||
inView: self.formViewController.view
|
||||
permittedArrowDirections: UIPopoverArrowDirectionAny
|
||||
animated: YES];
|
||||
} else {
|
||||
[self.formViewController presentViewController: imagePickerController
|
||||
animated: YES
|
||||
completion: nil];
|
||||
}
|
||||
|
||||
[self.formViewController presentViewController: imagePickerController
|
||||
animated: YES
|
||||
completion: nil];
|
||||
}
|
||||
|
||||
#pragma mark - UIImagePickerControllerDelegate
|
||||
@@ -137,8 +138,8 @@
|
||||
}
|
||||
|
||||
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
||||
if (self.formViewController.presentedViewController && self.formViewController.presentedViewController.modalPresentationStyle == UIModalPresentationPopover) {
|
||||
[self.formViewController dismissViewControllerAnimated:YES completion:nil];
|
||||
if (popoverController && popoverController.isPopoverVisible) {
|
||||
[popoverController dismissPopoverAnimated: YES];
|
||||
}
|
||||
} else {
|
||||
[self.formViewController dismissViewControllerAnimated: YES completion: nil];
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
#import "NSObject+XLFormAdditions.h"
|
||||
#import "XLFormLeftRightSelectorCell.h"
|
||||
|
||||
@interface XLFormLeftRightSelectorCell() <UIActionSheetDelegate>
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation XLFormLeftRightSelectorCell
|
||||
{
|
||||
UITextField * _constraintTextField;
|
||||
@@ -190,24 +195,76 @@
|
||||
|
||||
-(void)leftButtonPressed:(UIButton *)leftButton
|
||||
{
|
||||
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) weak = self;
|
||||
for (XLFormLeftRightSelectorOption * leftOption in self.rowDescriptor.selectorOptions) {
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:[leftOption.leftValue displayText]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
weak.rowDescriptor.value = [weak chooseNewRightValueFromOption:leftOption];
|
||||
weak.rowDescriptor.leftRightSelectorLeftOptionSelected = [weak leftOptionForDescription:[leftOption.leftValue displayText]].leftValue;
|
||||
[weak.formViewController updateFormRow:weak.rowDescriptor];
|
||||
}]];
|
||||
}
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
|
||||
delegate:self cancelButtonTitle:nil
|
||||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
|
||||
[self.formViewController presentViewController:alertController animated:YES completion:nil];
|
||||
for (XLFormLeftRightSelectorOption * leftOption in self.rowDescriptor.selectorOptions) {
|
||||
[actionSheet addButtonWithTitle:[leftOption.leftValue displayText]];
|
||||
}
|
||||
actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
|
||||
actionSheet.tag = [self.rowDescriptor hash];
|
||||
[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;
|
||||
for (XLFormLeftRightSelectorOption * leftOption in self.rowDescriptor.selectorOptions) {
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:[leftOption.leftValue displayText]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
weakSelf.rowDescriptor.value = [self chooseNewRightValueFromOption:leftOption];
|
||||
weakSelf.rowDescriptor.leftRightSelectorLeftOptionSelected = [self leftOptionForDescription:[leftOption.leftValue displayText]].leftValue;
|
||||
[weakSelf.formViewController updateFormRow:weakSelf.rowDescriptor];
|
||||
}]];
|
||||
}
|
||||
|
||||
[self.formViewController presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
#ifndef XL_APP_EXTENSIONS
|
||||
else{
|
||||
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
|
||||
delegate:self cancelButtonTitle:nil
|
||||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
|
||||
for (XLFormLeftRightSelectorOption * leftOption in self.rowDescriptor.selectorOptions) {
|
||||
[actionSheet addButtonWithTitle:[leftOption.leftValue displayText]];
|
||||
}
|
||||
actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
|
||||
actionSheet.tag = [self.rowDescriptor hash];
|
||||
[actionSheet showInView:self.formViewController.view];
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
|
||||
|
||||
#pragma mark - UIActionSheetDelegate
|
||||
|
||||
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||
{
|
||||
if ([actionSheet cancelButtonIndex] != buttonIndex){
|
||||
NSString * title = [actionSheet buttonTitleAtIndex:buttonIndex];
|
||||
if (![self.rowDescriptor.leftRightSelectorLeftOptionSelected isEqual:[self leftOptionForDescription:title].leftValue]){
|
||||
self.rowDescriptor.value = [self chooseNewRightValueFromOption:[self leftOptionForDescription:title]];
|
||||
self.rowDescriptor.leftRightSelectorLeftOptionSelected = [self leftOptionForDescription:title].leftValue;
|
||||
[self.formViewController updateFormRow:self.rowDescriptor];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -28,6 +28,6 @@
|
||||
|
||||
@interface XLFormPickerCell : XLFormBaseCell<XLFormInlineRowDescriptorCell>
|
||||
|
||||
@property (nonatomic, weak) UIPickerView * pickerView;
|
||||
@property (nonatomic) UIPickerView * pickerView;
|
||||
|
||||
@end
|
||||
|
||||
@@ -56,19 +56,23 @@
|
||||
return [self formDescriptorCellCanBecomeFirstResponder];
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
-(UIPickerView *)pickerView
|
||||
{
|
||||
if (_pickerView) return _pickerView;
|
||||
_pickerView = [UIPickerView autolayoutView];
|
||||
_pickerView.delegate = self;
|
||||
_pickerView.dataSource = self;
|
||||
return _pickerView;
|
||||
}
|
||||
|
||||
#pragma mark - XLFormDescriptorCell
|
||||
|
||||
-(void)configure
|
||||
{
|
||||
[super configure];
|
||||
|
||||
UIPickerView *pickerView = [UIPickerView autolayoutView];
|
||||
pickerView.delegate = self;
|
||||
pickerView.dataSource = self;
|
||||
|
||||
[self.contentView addSubview:pickerView];
|
||||
_pickerView = pickerView;
|
||||
|
||||
[self.contentView addSubview:self.pickerView];
|
||||
[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.pickerView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]];
|
||||
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[pickerView]-0-|" options:0 metrics:0 views:@{@"pickerView" : self.pickerView}]];
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
@interface XLFormSegmentedCell()
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray * dynamicCustomConstraints;
|
||||
@property NSMutableArray * dynamicCustomConstraints;
|
||||
|
||||
@end
|
||||
|
||||
@@ -168,9 +168,6 @@
|
||||
-(void)dealloc
|
||||
{
|
||||
[self.textLabel removeObserver:self forKeyPath:@"text"];
|
||||
|
||||
[self.dynamicCustomConstraints removeAllObjects];
|
||||
self.dynamicCustomConstraints = nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -29,9 +29,10 @@
|
||||
#import "XLFormSelectorCell.h"
|
||||
#import "NSArray+XLFormAdditions.h"
|
||||
|
||||
@interface XLFormSelectorCell() <UIPickerViewDelegate, UIPickerViewDataSource, UIPopoverPresentationControllerDelegate>
|
||||
@interface XLFormSelectorCell() <UIActionSheetDelegate, UIPickerViewDelegate, UIPickerViewDataSource, UIPopoverControllerDelegate>
|
||||
|
||||
@property (nonatomic) UIPickerView * pickerView;
|
||||
@property (nonatomic) UIPopoverController *popoverController;
|
||||
|
||||
@end
|
||||
|
||||
@@ -167,28 +168,21 @@
|
||||
selectorViewController.title = self.rowDescriptor.selectorTitle;
|
||||
|
||||
if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorPopover]) {
|
||||
UIViewController *popoverController = self.formViewController.presentedViewController;
|
||||
if (popoverController && popoverController.modalPresentationStyle == UIModalPresentationPopover) {
|
||||
[self.formViewController dismissViewControllerAnimated:NO completion:nil];
|
||||
if (self.popoverController && self.popoverController.popoverVisible) {
|
||||
[self.popoverController dismissPopoverAnimated:NO];
|
||||
}
|
||||
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:selectorViewController];
|
||||
self.popoverController.delegate = self;
|
||||
if ([selectorViewController conformsToProtocol:@protocol(XLFormRowDescriptorPopoverViewController)]){
|
||||
((id<XLFormRowDescriptorPopoverViewController>)selectorViewController).popoverController = self.popoverController;
|
||||
}
|
||||
selectorViewController.modalPresentationStyle = UIModalPresentationPopover;
|
||||
|
||||
selectorViewController.popoverPresentationController.delegate = self;
|
||||
if (self.detailTextLabel.window){
|
||||
selectorViewController.popoverPresentationController.sourceRect = CGRectMake(0, 0, self.detailTextLabel.frame.size.width, self.detailTextLabel.frame.size.height);
|
||||
selectorViewController.popoverPresentationController.sourceView = self.detailTextLabel;
|
||||
selectorViewController.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
|
||||
} else {
|
||||
selectorViewController.popoverPresentationController.sourceRect = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
|
||||
selectorViewController.popoverPresentationController.sourceView = self;
|
||||
selectorViewController.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
|
||||
[self.popoverController presentPopoverFromRect:CGRectMake(0, 0, self.detailTextLabel.frame.size.width, self.detailTextLabel.frame.size.height) inView:self.detailTextLabel permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
|
||||
}
|
||||
|
||||
[self.formViewController presentViewController:selectorViewController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
[controller.tableView deselectRowAtIndexPath:[controller.tableView indexPathForCell:self]
|
||||
animated:YES];
|
||||
else{
|
||||
[self.popoverController presentPopoverFromRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height) inView:self permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
|
||||
}
|
||||
[controller.tableView deselectRowAtIndexPath:[controller.tableView indexPathForCell:self] animated:YES];
|
||||
}
|
||||
else {
|
||||
[controller.navigationController pushViewController:selectorViewController animated:YES];
|
||||
@@ -200,24 +194,16 @@
|
||||
optionsViewController.title = self.rowDescriptor.selectorTitle;
|
||||
|
||||
if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorPopover]) {
|
||||
optionsViewController.modalPresentationStyle = UIModalPresentationPopover;
|
||||
|
||||
optionsViewController.popoverPresentationController.delegate = self;
|
||||
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:optionsViewController];
|
||||
self.popoverController.delegate = self;
|
||||
optionsViewController.popoverController = self.popoverController;
|
||||
if (self.detailTextLabel.window){
|
||||
optionsViewController.popoverPresentationController.sourceRect = CGRectMake(0, 0, self.detailTextLabel.frame.size.width, self.detailTextLabel.frame.size.height);
|
||||
optionsViewController.popoverPresentationController.sourceView = self.detailTextLabel;
|
||||
optionsViewController.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
|
||||
} else {
|
||||
optionsViewController.popoverPresentationController.sourceRect = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
|
||||
optionsViewController.popoverPresentationController.sourceView = self;
|
||||
optionsViewController.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
|
||||
[self.popoverController presentPopoverFromRect:CGRectMake(0, 0, self.detailTextLabel.frame.size.width, self.detailTextLabel.frame.size.height) inView:self.detailTextLabel permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
|
||||
}
|
||||
|
||||
[self.formViewController presentViewController:optionsViewController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
[controller.tableView deselectRowAtIndexPath:[controller.tableView indexPathForCell:self]
|
||||
animated:YES];
|
||||
else{
|
||||
[self.popoverController presentPopoverFromRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height) inView:self permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
|
||||
}
|
||||
[controller.tableView deselectRowAtIndexPath:[controller.tableView indexPathForCell:self] animated:YES];
|
||||
} else {
|
||||
[controller.navigationController pushViewController:optionsViewController animated:YES];
|
||||
}
|
||||
@@ -237,76 +223,135 @@
|
||||
optionsViewController.title = self.rowDescriptor.selectorTitle;
|
||||
|
||||
if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeMultipleSelectorPopover]) {
|
||||
optionsViewController.modalPresentationStyle = UIModalPresentationPopover;
|
||||
|
||||
optionsViewController.popoverPresentationController.delegate = self;
|
||||
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:optionsViewController];
|
||||
self.popoverController.delegate = self;
|
||||
optionsViewController.popoverController = self.popoverController;
|
||||
if (self.detailTextLabel.window){
|
||||
optionsViewController.popoverPresentationController.sourceRect = CGRectMake(0, 0, self.detailTextLabel.frame.size.width, self.detailTextLabel.frame.size.height);
|
||||
optionsViewController.popoverPresentationController.sourceView = self.detailTextLabel;
|
||||
optionsViewController.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
|
||||
} else {
|
||||
optionsViewController.popoverPresentationController.sourceRect = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
|
||||
optionsViewController.popoverPresentationController.sourceView = self;
|
||||
optionsViewController.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
|
||||
[self.popoverController presentPopoverFromRect:CGRectMake(0, 0, self.detailTextLabel.frame.size.width, self.detailTextLabel.frame.size.height) inView:self.detailTextLabel permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
|
||||
}
|
||||
else{
|
||||
[self.popoverController presentPopoverFromRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height) inView:self permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
|
||||
}
|
||||
|
||||
[self.formViewController presentViewController:optionsViewController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
[controller.tableView deselectRowAtIndexPath:[controller.tableView indexPathForCell:self] animated:YES];
|
||||
} else {
|
||||
[controller.navigationController pushViewController:optionsViewController animated:YES];
|
||||
}
|
||||
}
|
||||
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorActionSheet]){
|
||||
XLFormViewController * formViewController = self.formViewController;
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:self.rowDescriptor.selectorTitle
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil]];
|
||||
alertController.popoverPresentationController.sourceView = formViewController.tableView;
|
||||
UIView* v = (self.detailTextLabel ?: self.textLabel) ?: self.contentView;
|
||||
alertController.popoverPresentationController.sourceRect = [formViewController.tableView convertRect:v.frame fromView:self];
|
||||
__weak __typeof(self)weakSelf = self;
|
||||
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
|
||||
delegate:self
|
||||
cancelButtonTitle:nil
|
||||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
for (id option in self.rowDescriptor.selectorOptions) {
|
||||
NSString *optionTitle = [option displayText];
|
||||
if (self.rowDescriptor.valueTransformer){
|
||||
NSAssert([self.rowDescriptor.valueTransformer isSubclassOfClass:[NSValueTransformer class]], @"valueTransformer is not a subclass of NSValueTransformer");
|
||||
NSValueTransformer * valueTransformer = [self.rowDescriptor.valueTransformer new];
|
||||
NSString * transformedValue = [valueTransformer transformedValue:[option valueData]];
|
||||
if (transformedValue) {
|
||||
optionTitle = transformedValue;
|
||||
}
|
||||
}
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:optionTitle
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[weakSelf.rowDescriptor setValue:option];
|
||||
[formViewController.tableView reloadData];
|
||||
}]];
|
||||
[actionSheet addButtonWithTitle:[option displayText]];
|
||||
}
|
||||
[formViewController presentViewController:alertController animated:YES completion:nil];
|
||||
actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
|
||||
actionSheet.tag = [self.rowDescriptor hash];
|
||||
[actionSheet showInView:controller.view];
|
||||
#else
|
||||
if ([UIAlertController class]) {
|
||||
XLFormViewController * formViewController = self.formViewController;
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:self.rowDescriptor.selectorTitle
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil]];
|
||||
alertController.popoverPresentationController.sourceView = formViewController.tableView;
|
||||
UIView* v = (self.detailTextLabel ?: self.textLabel) ?: self.contentView;
|
||||
alertController.popoverPresentationController.sourceRect = [formViewController.tableView convertRect:v.frame fromView:self];
|
||||
__weak __typeof(self)weakSelf = self;
|
||||
for (id option in self.rowDescriptor.selectorOptions) {
|
||||
NSString *optionTitle = [option displayText];
|
||||
if (self.rowDescriptor.valueTransformer){
|
||||
NSAssert([self.rowDescriptor.valueTransformer isSubclassOfClass:[NSValueTransformer class]], @"valueTransformer is not a subclass of NSValueTransformer");
|
||||
NSValueTransformer * valueTransformer = [self.rowDescriptor.valueTransformer new];
|
||||
NSString * transformedValue = [valueTransformer transformedValue:[option valueData]];
|
||||
if (transformedValue) {
|
||||
optionTitle = transformedValue;
|
||||
}
|
||||
}
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:optionTitle
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[weakSelf.rowDescriptor setValue:option];
|
||||
[formViewController.tableView reloadData];
|
||||
}]];
|
||||
}
|
||||
[formViewController presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
#ifndef XL_APP_EXTENSIONS
|
||||
else{
|
||||
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
|
||||
delegate:self
|
||||
cancelButtonTitle:nil
|
||||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
for (id option in self.rowDescriptor.selectorOptions) {
|
||||
[actionSheet addButtonWithTitle:[option displayText]];
|
||||
}
|
||||
actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
|
||||
actionSheet.tag = [self.rowDescriptor hash];
|
||||
[actionSheet showInView:controller.view];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
[controller.tableView deselectRowAtIndexPath:[controller.form indexPathOfFormRow:self.rowDescriptor] animated:YES];
|
||||
}
|
||||
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorAlertView]){
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:self.rowDescriptor.selectorTitle
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
__weak __typeof(self)weakSelf = self;
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:self.rowDescriptor.selectorTitle
|
||||
message:nil
|
||||
delegate:self
|
||||
cancelButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
for (id option in self.rowDescriptor.selectorOptions) {
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:[option displayText]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[weakSelf.rowDescriptor setValue:option];
|
||||
[weakSelf.formViewController.tableView reloadData];
|
||||
}]];
|
||||
[alertView addButtonWithTitle:[option displayText]];
|
||||
}
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil]];
|
||||
[controller presentViewController:alertController animated:YES completion:nil];
|
||||
alertView.cancelButtonIndex = [alertView addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
|
||||
alertView.tag = [self.rowDescriptor hash];
|
||||
[alertView show];
|
||||
#else
|
||||
if ([UIAlertController class]) {
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:self.rowDescriptor.selectorTitle
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
__weak __typeof(self)weakSelf = self;
|
||||
for (id option in self.rowDescriptor.selectorOptions) {
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:[option displayText]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[weakSelf.rowDescriptor setValue:option];
|
||||
[weakSelf.formViewController.tableView reloadData];
|
||||
}]];
|
||||
}
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil]];
|
||||
[controller presentViewController:alertController animated:YES completion:nil];
|
||||
|
||||
}
|
||||
#ifndef XL_APP_EXTENSIONS
|
||||
else{
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:self.rowDescriptor.selectorTitle
|
||||
message:nil
|
||||
delegate:self
|
||||
cancelButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
for (id option in self.rowDescriptor.selectorOptions) {
|
||||
[alertView addButtonWithTitle:[option displayText]];
|
||||
}
|
||||
alertView.cancelButtonIndex = [alertView addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
|
||||
alertView.tag = [self.rowDescriptor hash];
|
||||
[alertView show];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
[controller.tableView deselectRowAtIndexPath:[controller.form indexPathOfFormRow:self.rowDescriptor] animated:YES];
|
||||
}
|
||||
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorPickerView]){
|
||||
@@ -327,6 +372,47 @@
|
||||
self.detailTextLabel.textColor = _beforeChangeColor;
|
||||
}
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
|
||||
|
||||
#pragma mark - UIActionSheetDelegate
|
||||
|
||||
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||
{
|
||||
if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorActionSheet]){
|
||||
if ([actionSheet cancelButtonIndex] != buttonIndex){
|
||||
NSString * title = [actionSheet buttonTitleAtIndex:buttonIndex];
|
||||
for (id option in self.rowDescriptor.selectorOptions){
|
||||
if ([[option displayText] isEqualToString:title]){
|
||||
[self.rowDescriptor setValue:option];
|
||||
[self.formViewController.tableView reloadData];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UIAlertViewDelegate
|
||||
|
||||
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||
{
|
||||
if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorAlertView]){
|
||||
if ([alertView cancelButtonIndex] != buttonIndex){
|
||||
NSString * title = [alertView buttonTitleAtIndex:buttonIndex];
|
||||
for (id option in self.rowDescriptor.selectorOptions){
|
||||
if ([[option displayText] isEqualToString:title]){
|
||||
[self.rowDescriptor setValue:option];
|
||||
[self.formViewController.tableView reloadData];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#pragma mark - UIPickerViewDelegate
|
||||
|
||||
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
|
||||
@@ -363,11 +449,6 @@
|
||||
return self.rowDescriptor.selectorOptions.count;
|
||||
}
|
||||
|
||||
#pragma mark - UIPopoverPresentationControllerDelegate
|
||||
|
||||
- (void)popoverPresentationControllerDidDismissPopover:(UIPopoverPresentationController *)popoverPresentationController {
|
||||
[self.formViewController.tableView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - Helpers
|
||||
|
||||
@@ -412,4 +493,12 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UIPopoverControllerDelegate
|
||||
|
||||
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
|
||||
{
|
||||
[self.formViewController.tableView reloadData];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -31,10 +31,10 @@ extern NSString *const XLFormTextFieldMaxNumberOfCharacters;
|
||||
|
||||
@interface XLFormTextFieldCell : XLFormBaseCell <XLFormReturnKeyProtocol>
|
||||
|
||||
@property (nonatomic, readonly, weak) UILabel * textLabel;
|
||||
@property (nonatomic, readonly, weak) UITextField * textField;
|
||||
@property (nonatomic, readonly) UILabel * textLabel;
|
||||
@property (nonatomic, readonly) UITextField * textField;
|
||||
|
||||
@property (nonatomic, copy) NSNumber *textFieldLengthPercentage;
|
||||
@property (nonatomic, copy) NSNumber *textFieldMaxNumberOfCharacters;
|
||||
@property (nonatomic) NSNumber *textFieldLengthPercentage;
|
||||
@property (nonatomic) NSNumber *textFieldMaxNumberOfCharacters;
|
||||
|
||||
@end
|
||||
|
||||
@@ -34,7 +34,7 @@ NSString *const XLFormTextFieldMaxNumberOfCharacters = @"textFieldMaxNumberOfCha
|
||||
|
||||
@interface XLFormTextFieldCell() <UITextFieldDelegate>
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray * dynamicCustomConstraints;
|
||||
@property NSMutableArray * dynamicCustomConstraints;
|
||||
|
||||
@end
|
||||
|
||||
@@ -69,14 +69,8 @@ NSString *const XLFormTextFieldMaxNumberOfCharacters = @"textFieldMaxNumberOfCha
|
||||
|
||||
-(void)dealloc
|
||||
{
|
||||
[self.textField removeTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
|
||||
[self.textLabel removeObserver:self forKeyPath:@"text"];
|
||||
[self.imageView removeObserver:self forKeyPath:@"image"];
|
||||
|
||||
self.textField.delegate = nil;
|
||||
|
||||
[self.dynamicCustomConstraints removeAllObjects];
|
||||
self.dynamicCustomConstraints = nil;
|
||||
}
|
||||
|
||||
#pragma mark - XLFormDescriptorCell
|
||||
@@ -85,14 +79,8 @@ NSString *const XLFormTextFieldMaxNumberOfCharacters = @"textFieldMaxNumberOfCha
|
||||
{
|
||||
[super configure];
|
||||
[self setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||||
UILabel *textLabel = [UILabel autolayoutView];
|
||||
[self.contentView addSubview:textLabel];
|
||||
_textLabel = textLabel;
|
||||
|
||||
UITextField *textField = [UITextField autolayoutView];
|
||||
[self.contentView addSubview:textField];
|
||||
_textField = textField;
|
||||
|
||||
[self.contentView addSubview:self.textLabel];
|
||||
[self.contentView addSubview:self.textField];
|
||||
[self.contentView addConstraints:[self layoutConstraints]];
|
||||
[self.textLabel addObserver:self forKeyPath:@"text" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:0];
|
||||
[self.imageView addObserver:self forKeyPath:@"image" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:0];
|
||||
@@ -188,6 +176,22 @@ NSString *const XLFormTextFieldMaxNumberOfCharacters = @"textFieldMaxNumberOfCha
|
||||
[self.formViewController updateFormRow:self.rowDescriptor];
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
-(UILabel *)textLabel
|
||||
{
|
||||
if (_textLabel) return _textLabel;
|
||||
_textLabel = [UILabel autolayoutView];
|
||||
return _textLabel;
|
||||
}
|
||||
|
||||
-(UITextField *)textField
|
||||
{
|
||||
if (_textField) return _textField;
|
||||
_textField = [UITextField autolayoutView];
|
||||
return _textField;
|
||||
}
|
||||
|
||||
#pragma mark - LayoutConstraints
|
||||
|
||||
-(NSArray *)layoutConstraints
|
||||
@@ -221,10 +225,10 @@ NSString *const XLFormTextFieldMaxNumberOfCharacters = @"textFieldMaxNumberOfCha
|
||||
self.dynamicCustomConstraints = [NSMutableArray arrayWithArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[image]-[label]-[textField]-|" options:0 metrics:nil views:views]];
|
||||
[self.dynamicCustomConstraints addObject:[NSLayoutConstraint constraintWithItem:_textField
|
||||
attribute:NSLayoutAttributeWidth
|
||||
relatedBy:self.textFieldLengthPercentage != nil ? NSLayoutRelationEqual : NSLayoutRelationGreaterThanOrEqual
|
||||
relatedBy:self.textFieldLengthPercentage ? NSLayoutRelationEqual : NSLayoutRelationGreaterThanOrEqual
|
||||
toItem:self.contentView
|
||||
attribute:NSLayoutAttributeWidth
|
||||
multiplier:self.textFieldLengthPercentage != nil ? [self.textFieldLengthPercentage floatValue] : 0.3
|
||||
multiplier:self.textFieldLengthPercentage ? [self.textFieldLengthPercentage floatValue] : 0.3
|
||||
constant:0.0]];
|
||||
}
|
||||
else{
|
||||
@@ -236,10 +240,10 @@ NSString *const XLFormTextFieldMaxNumberOfCharacters = @"textFieldMaxNumberOfCha
|
||||
self.dynamicCustomConstraints = [NSMutableArray arrayWithArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[label]-[textField]-|" options:0 metrics:nil views:views]];
|
||||
[self.dynamicCustomConstraints addObject:[NSLayoutConstraint constraintWithItem:_textField
|
||||
attribute:NSLayoutAttributeWidth
|
||||
relatedBy:self.textFieldLengthPercentage != nil ? NSLayoutRelationEqual : NSLayoutRelationGreaterThanOrEqual
|
||||
relatedBy:self.textFieldLengthPercentage ? NSLayoutRelationEqual : NSLayoutRelationGreaterThanOrEqual
|
||||
toItem:self.contentView
|
||||
attribute:NSLayoutAttributeWidth
|
||||
multiplier:self.textFieldLengthPercentage != nil ? [self.textFieldLengthPercentage floatValue] : 0.3
|
||||
multiplier:self.textFieldLengthPercentage ? [self.textFieldLengthPercentage floatValue] : 0.3
|
||||
constant:0.0]];
|
||||
}
|
||||
else{
|
||||
@@ -275,7 +279,7 @@ NSString *const XLFormTextFieldMaxNumberOfCharacters = @"textFieldMaxNumberOfCha
|
||||
}
|
||||
|
||||
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
|
||||
if (self.textFieldMaxNumberOfCharacters != nil) {
|
||||
if (self.textFieldMaxNumberOfCharacters) {
|
||||
// Check maximum length requirement
|
||||
NSString *newString = [textField.text stringByReplacingCharactersInRange:range withString:string];
|
||||
if (newString.length > self.textFieldMaxNumberOfCharacters.integerValue) {
|
||||
|
||||
@@ -33,10 +33,10 @@ extern NSString *const XLFormTextViewMaxNumberOfCharacters;
|
||||
@interface XLFormTextViewCell : XLFormBaseCell
|
||||
|
||||
@property (nonatomic, readonly) UILabel * label DEPRECATED_ATTRIBUTE DEPRECATED_MSG_ATTRIBUTE("Use textLabel instead");
|
||||
@property (nonatomic, readonly, weak) UILabel * textLabel;
|
||||
@property (nonatomic, readonly, weak) XLFormTextView * textView;
|
||||
@property (nonatomic, readonly) UILabel * textLabel;
|
||||
@property (nonatomic, readonly) XLFormTextView * textView;
|
||||
|
||||
@property (nonatomic, copy) NSNumber *textViewLengthPercentage;
|
||||
@property (nonatomic, copy) NSNumber *textViewMaxNumberOfCharacters;
|
||||
@property (nonatomic) NSNumber *textViewLengthPercentage;
|
||||
@property (nonatomic) NSNumber *textViewMaxNumberOfCharacters;
|
||||
|
||||
@end
|
||||
|
||||
@@ -70,26 +70,34 @@ NSString *const XLFormTextViewMaxNumberOfCharacters = @"textViewMaxNumberOfChara
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
-(UILabel *)textLabel
|
||||
{
|
||||
if (_textLabel) return _textLabel;
|
||||
_textLabel = [UILabel autolayoutView];
|
||||
[_textLabel setContentHuggingPriority:500 forAxis:UILayoutConstraintAxisHorizontal];
|
||||
return _textLabel;
|
||||
}
|
||||
|
||||
-(UILabel *)label
|
||||
{
|
||||
return self.textLabel;
|
||||
}
|
||||
|
||||
-(XLFormTextView *)textView
|
||||
{
|
||||
if (_textView) return _textView;
|
||||
_textView = [XLFormTextView autolayoutView];
|
||||
return _textView;
|
||||
}
|
||||
|
||||
#pragma mark - XLFormDescriptorCell
|
||||
|
||||
-(void)configure
|
||||
{
|
||||
[super configure];
|
||||
[self setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||||
UILabel *textLabel = [UILabel autolayoutView];
|
||||
[textLabel setContentHuggingPriority:500 forAxis:UILayoutConstraintAxisHorizontal];
|
||||
[self.contentView addSubview:textLabel];
|
||||
_textLabel = textLabel;
|
||||
|
||||
XLFormTextView *textView = [XLFormTextView autolayoutView];
|
||||
[self.contentView addSubview:textView];
|
||||
_textView = textView;
|
||||
|
||||
[self.contentView addSubview:self.textLabel];
|
||||
[self.contentView addSubview:self.textView];
|
||||
[self.textLabel addObserver:self forKeyPath:@"text" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:0];
|
||||
NSDictionary * views = @{@"label": self.textLabel, @"textView": self.textView};
|
||||
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-8-[label]" options:0 metrics:0 views:views]];
|
||||
@@ -152,7 +160,7 @@ NSString *const XLFormTextViewMaxNumberOfCharacters = @"textViewMaxNumberOfChara
|
||||
}
|
||||
else{
|
||||
[_dynamicCustomConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[label]-[textView]-|" options:0 metrics:0 views:views]];
|
||||
if (self.textViewLengthPercentage != nil) {
|
||||
if (self.textViewLengthPercentage) {
|
||||
[_dynamicCustomConstraints addObject:[NSLayoutConstraint constraintWithItem:_textView
|
||||
attribute:NSLayoutAttributeWidth
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
@@ -199,7 +207,7 @@ NSString *const XLFormTextViewMaxNumberOfCharacters = @"textViewMaxNumberOfChara
|
||||
}
|
||||
|
||||
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
|
||||
if (self.textViewMaxNumberOfCharacters != nil) {
|
||||
if (self.textViewMaxNumberOfCharacters) {
|
||||
// Check maximum length requirement
|
||||
NSString *newText = [textView.text stringByReplacingCharactersInRange:range withString:text];
|
||||
if (newText.length > self.textViewMaxNumberOfCharacters.integerValue) {
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
@interface XLFormOptionsObject : NSObject <XLFormOptionObject,NSCoding>
|
||||
|
||||
@property (nonatomic, copy) NSString * formDisplaytext;
|
||||
@property (nonatomic, strong) id formValue;
|
||||
@property (nonatomic) NSString * formDisplaytext;
|
||||
@property (nonatomic) id formValue;
|
||||
|
||||
+(XLFormOptionsObject *)formOptionsObjectWithValue:(id)value displayText:(NSString *)displayText;
|
||||
+(XLFormOptionsObject *)formOptionsOptionForValue:(id)value fromOptions:(NSArray *)options;
|
||||
|
||||
@@ -107,9 +107,4 @@
|
||||
|
||||
}
|
||||
|
||||
-(NSUInteger)hash
|
||||
{
|
||||
return [[self formValue ] hash];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#import "XLFormRowDescriptorViewController.h"
|
||||
#import "XLFormRowDescriptor.h"
|
||||
|
||||
@interface XLFormOptionsViewController : UITableViewController<XLFormRowDescriptorViewController>
|
||||
@interface XLFormOptionsViewController : UITableViewController<XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController>
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewStyle)style;
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
|
||||
@interface XLFormOptionsViewController () <UITableViewDataSource>
|
||||
|
||||
@property (nonatomic, copy) NSString * titleHeaderSection;
|
||||
@property (nonatomic, copy) NSString * titleFooterSection;
|
||||
@property NSString * titleHeaderSection;
|
||||
@property NSString * titleFooterSection;
|
||||
|
||||
|
||||
@end
|
||||
@@ -45,6 +45,7 @@
|
||||
@synthesize titleHeaderSection = _titleHeaderSection;
|
||||
@synthesize titleFooterSection = _titleFooterSection;
|
||||
@synthesize rowDescriptor = _rowDescriptor;
|
||||
@synthesize popoverController = __popoverController;
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewStyle)style
|
||||
{
|
||||
@@ -152,8 +153,9 @@
|
||||
self.rowDescriptor.value = cellObject;
|
||||
cell.accessoryType = UITableViewCellAccessoryCheckmark;
|
||||
}
|
||||
if (self.modalPresentationStyle == UIModalPresentationPopover){
|
||||
[[self presentingViewController] dismissViewControllerAnimated:YES completion:nil];
|
||||
if (self.popoverController){
|
||||
[self.popoverController dismissPopoverAnimated:YES];
|
||||
[self.popoverController.delegate popoverControllerDidDismissPopover:self.popoverController];
|
||||
}
|
||||
else if ([self.parentViewController isKindOfClass:[UINavigationController class]]){
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
|
||||
@@ -30,6 +30,14 @@
|
||||
@protocol XLFormRowDescriptorViewController <NSObject>
|
||||
|
||||
@required
|
||||
@property (nonatomic, weak) XLFormRowDescriptor * rowDescriptor;
|
||||
@property (nonatomic) XLFormRowDescriptor * rowDescriptor;
|
||||
|
||||
@end
|
||||
|
||||
@protocol XLFormRowDescriptorPopoverViewController <NSObject>
|
||||
|
||||
@required
|
||||
@property (nonatomic) UIPopoverController * popoverController;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -52,6 +52,7 @@ typedef NS_ENUM(NSUInteger, XLFormRowNavigationDirection) {
|
||||
-(XLFormBaseCell *)updateFormRow:(XLFormRowDescriptor *)formRow;
|
||||
|
||||
-(NSDictionary *)formValues;
|
||||
-(NSDictionary *)formValuesIncludingHidden;
|
||||
-(NSDictionary *)httpParameters;
|
||||
|
||||
-(XLFormRowDescriptor *)formRowFormMultivaluedFormSection:(XLFormSectionDescriptor *)formSection;
|
||||
@@ -79,10 +80,10 @@ typedef NS_ENUM(NSUInteger, XLFormRowNavigationDirection) {
|
||||
|
||||
@end
|
||||
|
||||
@interface XLFormViewController : UIViewController<UITableViewDataSource, UITableViewDelegate, XLFormDescriptorDelegate, UITextFieldDelegate, UITextViewDelegate, XLFormViewControllerDelegate>
|
||||
@interface XLFormViewController : UIViewController<UITableViewDataSource, UITableViewDelegate, XLFormDescriptorDelegate, UITextFieldDelegate, UITextViewDelegate, UIActionSheetDelegate, XLFormViewControllerDelegate>
|
||||
|
||||
@property (nonatomic, strong) XLFormDescriptor * form;
|
||||
@property (nonatomic, weak) IBOutlet UITableView * tableView;
|
||||
@property XLFormDescriptor * form;
|
||||
@property IBOutlet UITableView * tableView;
|
||||
|
||||
-(instancetype)initWithForm:(XLFormDescriptor *)form;
|
||||
-(instancetype)initWithForm:(XLFormDescriptor *)form style:(UITableViewStyle)style;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
@interface XLFormRowDescriptor(_XLFormViewController)
|
||||
|
||||
@property (readonly) NSArray * observers;
|
||||
-(BOOL)evaluateIsDisabled;
|
||||
-(BOOL)evaluateIsHidden;
|
||||
|
||||
@@ -46,7 +47,7 @@
|
||||
|
||||
@interface XLFormDescriptor (_XLFormViewController)
|
||||
|
||||
@property (atomic, strong) NSMutableDictionary* rowObservers;
|
||||
@property NSMutableDictionary* rowObservers;
|
||||
|
||||
@end
|
||||
|
||||
@@ -56,8 +57,8 @@
|
||||
NSNumber *_oldBottomTableContentInset;
|
||||
CGRect _keyboardFrame;
|
||||
}
|
||||
@property (nonatomic, assign) UITableViewStyle tableViewStyle;
|
||||
@property (nonatomic, strong) XLFormRowNavigationAccessoryView * navigationAccessoryView;
|
||||
@property UITableViewStyle tableViewStyle;
|
||||
@property (nonatomic) XLFormRowNavigationAccessoryView * navigationAccessoryView;
|
||||
|
||||
@end
|
||||
|
||||
@@ -103,34 +104,25 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc
|
||||
- (void)dealloc
|
||||
{
|
||||
[self removeObserverFromController];
|
||||
|
||||
self.tableView.delegate = nil;
|
||||
self.tableView.dataSource = nil;
|
||||
|
||||
self.form.delegate = nil;
|
||||
|
||||
self.navigationAccessoryView = nil;
|
||||
}
|
||||
|
||||
-(void)viewDidLoad
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
UITableView *tableView = self.tableView;
|
||||
if (!tableView){
|
||||
tableView = [[UITableView alloc] initWithFrame:self.view.bounds
|
||||
if (!self.tableView){
|
||||
self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds
|
||||
style:self.tableViewStyle];
|
||||
tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
if([tableView respondsToSelector:@selector(cellLayoutMarginsFollowReadableWidth)]){
|
||||
tableView.cellLayoutMarginsFollowReadableWidth = NO;
|
||||
self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
if([self.tableView respondsToSelector:@selector(cellLayoutMarginsFollowReadableWidth)]){
|
||||
self.tableView.cellLayoutMarginsFollowReadableWidth = NO;
|
||||
}
|
||||
}
|
||||
if (!tableView.superview){
|
||||
[self.view addSubview:tableView];
|
||||
self.tableView = tableView;
|
||||
if (!self.tableView.superview){
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
if (!self.tableView.delegate){
|
||||
self.tableView.delegate = self;
|
||||
@@ -155,18 +147,44 @@
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
NSIndexPath *selected = [self.tableView indexPathForSelectedRow];
|
||||
if (selected) {
|
||||
if (selected){
|
||||
// Trigger a cell refresh
|
||||
XLFormRowDescriptor * rowDescriptor = [self.form formRowAtIndex:selected];
|
||||
[self updateFormRow:rowDescriptor];
|
||||
[self.tableView selectRowAtIndexPath:selected animated:NO scrollPosition:UITableViewScrollPositionNone];
|
||||
[self.tableView deselectRowAtIndexPath:selected animated:YES];
|
||||
}
|
||||
|
||||
[self addObserverToController];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(contentSizeCategoryChanged:)
|
||||
name:UIContentSizeCategoryDidChangeNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(keyboardWillShow:)
|
||||
name:UIKeyboardWillShowNotification
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(keyboardWillHide:)
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
|
||||
}
|
||||
|
||||
-(void)viewDidAppear:(BOOL)animated
|
||||
-(void)viewDidDisappear:(BOOL)animated
|
||||
{
|
||||
[super viewDidDisappear:animated];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:UIContentSizeCategoryDidChangeNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:UIKeyboardWillShowNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated
|
||||
{
|
||||
[super viewDidAppear:animated];
|
||||
if (self.form.assignFirstResponderOnShow) {
|
||||
@@ -175,40 +193,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
-(void)viewDidDisappear:(BOOL)animated
|
||||
{
|
||||
[super viewDidDisappear:animated];
|
||||
|
||||
[self removeObserverFromController];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning
|
||||
{
|
||||
[super didReceiveMemoryWarning];
|
||||
}
|
||||
|
||||
-(void)addObserverToController {
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc addObserver:self
|
||||
selector:@selector(contentSizeCategoryChanged:)
|
||||
name:UIContentSizeCategoryDidChangeNotification
|
||||
object:nil];
|
||||
[nc addObserver:self
|
||||
selector:@selector(keyboardWillShow:)
|
||||
name:UIKeyboardWillShowNotification
|
||||
object:nil];
|
||||
[nc addObserver:self
|
||||
selector:@selector(keyboardWillHide:)
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
-(void)removeObserverFromController {
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc removeObserver:self name:UIContentSizeCategoryDidChangeNotification object:nil];
|
||||
[nc removeObserver:self name:UIKeyboardWillShowNotification object:nil];
|
||||
[nc removeObserver:self name:UIKeyboardWillHideNotification object:nil];
|
||||
}
|
||||
#pragma mark - CellClasses
|
||||
|
||||
+(NSMutableDictionary *)cellClassesForRowDescriptorTypes
|
||||
@@ -325,8 +314,8 @@
|
||||
|
||||
-(void)updateAfterDependentRowChanged:(XLFormRowDescriptor *)formRow
|
||||
{
|
||||
NSMutableArray* revaluateHidden = [self.form.rowObservers[[formRow.tag formKeyForPredicateType:XLPredicateTypeHidden]] mutableCopy];
|
||||
NSMutableArray* revaluateDisabled = [self.form.rowObservers[[formRow.tag formKeyForPredicateType:XLPredicateTypeDisabled]] mutableCopy];
|
||||
NSMutableArray* revaluateHidden = self.form.rowObservers[[formRow.tag formKeyForPredicateType:XLPredicateTypeHidden]];
|
||||
NSMutableArray* revaluateDisabled = self.form.rowObservers[[formRow.tag formKeyForPredicateType:XLPredicateTypeDisabled]];
|
||||
for (id object in revaluateDisabled) {
|
||||
if ([object isKindOfClass:[NSString class]]) {
|
||||
XLFormRowDescriptor* row = [self.form formRowWithTag:object];
|
||||
@@ -357,6 +346,11 @@
|
||||
return [self.form formValues];
|
||||
}
|
||||
|
||||
-(NSDictionary *)formValuesIncludingHidden
|
||||
{
|
||||
return [self.form formValuesIncludingHidden];
|
||||
}
|
||||
|
||||
-(NSDictionary *)httpParameters
|
||||
{
|
||||
return [self.form httpParameters:self];
|
||||
@@ -445,10 +439,9 @@
|
||||
XLFormSectionDescriptor * multivaluedFormSection = formRow.sectionDescriptor;
|
||||
XLFormRowDescriptor * formRowDescriptor = [self formRowFormMultivaluedFormSection:multivaluedFormSection];
|
||||
[multivaluedFormSection addFormRow:formRowDescriptor];
|
||||
__weak typeof(self) weak = self;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
weak.tableView.editing = !weak.tableView.editing;
|
||||
weak.tableView.editing = !weak.tableView.editing;
|
||||
self.tableView.editing = !self.tableView.editing;
|
||||
self.tableView.editing = !self.tableView.editing;
|
||||
});
|
||||
UITableViewCell<XLFormDescriptorCell> * cell = (UITableViewCell<XLFormDescriptorCell> *)[formRowDescriptor cellForFormController:self];
|
||||
if ([cell formDescriptorCellCanBecomeFirstResponder]){
|
||||
@@ -474,24 +467,66 @@
|
||||
|
||||
-(void)showFormValidationError:(NSError *)error
|
||||
{
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"XLFormViewController_ValidationErrorTitle", nil)
|
||||
message:error.localizedDescription
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:@"OK"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:nil]];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"XLFormViewController_ValidationErrorTitle", nil)
|
||||
message:error.localizedDescription
|
||||
delegate:self
|
||||
cancelButtonTitle:NSLocalizedString(@"OK", nil)
|
||||
otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
#else
|
||||
if ([UIAlertController class]){
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"XLFormViewController_ValidationErrorTitle", nil)
|
||||
message:error.localizedDescription
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:@"OK"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:nil]];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
#ifndef XL_APP_EXTENSIONS
|
||||
else{
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"XLFormViewController_ValidationErrorTitle", nil)
|
||||
message:error.localizedDescription
|
||||
delegate:self
|
||||
cancelButtonTitle:NSLocalizedString(@"OK", nil)
|
||||
otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
-(void)showFormValidationError:(NSError *)error withTitle:(NSString*)title
|
||||
{
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(title, nil)
|
||||
message:error.localizedDescription
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:@"OK"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:nil]];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(title, nil)
|
||||
message:error.localizedDescription
|
||||
delegate:self
|
||||
cancelButtonTitle:NSLocalizedString(@"OK", nil)
|
||||
otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
#else
|
||||
if ([UIAlertController class]){
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(title, nil)
|
||||
message:error.localizedDescription
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:@"OK"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:nil]];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
#ifndef XL_APP_EXTENSIONS
|
||||
else{
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(title, nil)
|
||||
message:error.localizedDescription
|
||||
delegate:self
|
||||
cancelButtonTitle:NSLocalizedString(@"OK", nil)
|
||||
otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
-(void)performFormSelector:(SEL)selector withObject:(id)sender
|
||||
@@ -580,24 +615,18 @@
|
||||
-(XLFormBaseCell *)updateFormRow:(XLFormRowDescriptor *)formRow
|
||||
{
|
||||
XLFormBaseCell * cell = [formRow cellForFormController:self];
|
||||
if (cell != nil) {
|
||||
[self configureCell:cell];
|
||||
[cell setNeedsUpdateConstraints];
|
||||
[cell setNeedsLayout];
|
||||
}
|
||||
[self configureCell:cell];
|
||||
[cell setNeedsUpdateConstraints];
|
||||
[cell setNeedsLayout];
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(void)configureCell:(XLFormBaseCell*) cell
|
||||
{
|
||||
[cell update];
|
||||
|
||||
if(cell.rowDescriptor != nil && cell.rowDescriptor.cellConfig != nil) {
|
||||
[cell.rowDescriptor.cellConfig enumerateKeysAndObjectsUsingBlock:^(NSString *keyPath, id value, BOOL * __unused stop) {
|
||||
[cell setValue:(value == [NSNull null]) ? nil : value forKeyPath:keyPath];
|
||||
}];
|
||||
}
|
||||
|
||||
[cell.rowDescriptor.cellConfig enumerateKeysAndObjectsUsingBlock:^(NSString *keyPath, id value, BOOL * __unused stop) {
|
||||
[cell setValue:(value == [NSNull null]) ? nil : value forKeyPath:keyPath];
|
||||
}];
|
||||
if (cell.rowDescriptor.isDisabled){
|
||||
[cell.rowDescriptor.cellConfigIfDisabled enumerateKeysAndObjectsUsingBlock:^(NSString *keyPath, id value, BOOL * __unused stop) {
|
||||
[cell setValue:(value == [NSNull null]) ? nil : value forKeyPath:keyPath];
|
||||
@@ -668,10 +697,9 @@
|
||||
#pragma GCC diagnostic pop
|
||||
// update the accessory view
|
||||
[self inputAccessoryViewForRowDescriptor:row];
|
||||
__weak typeof(self) weak = self;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
weak.tableView.editing = !weak.tableView.editing;
|
||||
weak.tableView.editing = !weak.tableView.editing;
|
||||
self.tableView.editing = !self.tableView.editing;
|
||||
self.tableView.editing = !self.tableView.editing;
|
||||
});
|
||||
|
||||
}
|
||||
@@ -686,10 +714,9 @@
|
||||
[self.tableView endEditing:YES];
|
||||
}
|
||||
[multivaluedFormRow.sectionDescriptor removeFormRowAtIndex:indexPath.row];
|
||||
__weak typeof(self) weak = self;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
weak.tableView.editing = !weak.tableView.editing;
|
||||
weak.tableView.editing = !weak.tableView.editing;
|
||||
self.tableView.editing = !self.tableView.editing;
|
||||
self.tableView.editing = !self.tableView.editing;
|
||||
});
|
||||
if (firstResponder){
|
||||
UITableViewCell<XLFormDescriptorCell> * firstResponderCell = [firstResponder formDescriptorCell];
|
||||
@@ -706,10 +733,9 @@
|
||||
else{
|
||||
XLFormRowDescriptor * formRowDescriptor = [self formRowFormMultivaluedFormSection:multivaluedFormSection];
|
||||
[multivaluedFormSection addFormRow:formRowDescriptor];
|
||||
__weak typeof(self) weak = self;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
weak.tableView.editing = !weak.tableView.editing;
|
||||
weak.tableView.editing = !weak.tableView.editing;
|
||||
self.tableView.editing = !self.tableView.editing;
|
||||
self.tableView.editing = !self.tableView.editing;
|
||||
});
|
||||
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row + 1 inSection:indexPath.section] atScrollPosition:UITableViewScrollPositionBottom animated:YES];
|
||||
UITableViewCell<XLFormDescriptorCell> * cell = (UITableViewCell<XLFormDescriptorCell> *)[formRowDescriptor cellForFormController:self];
|
||||
|
||||
@@ -49,15 +49,15 @@ typedef NS_OPTIONS(NSUInteger, XLFormRowNavigationOptions) {
|
||||
|
||||
@interface XLFormDescriptor : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly, nonnull) NSMutableArray * formSections;
|
||||
@property (nonatomic, readonly, nullable, copy) NSString * title;
|
||||
@property (nonatomic, assign) BOOL endEditingTableViewOnScroll;
|
||||
@property (nonatomic, assign) BOOL assignFirstResponderOnShow;
|
||||
@property (nonatomic, assign) BOOL addAsteriskToRequiredRowsTitle;
|
||||
@property (nonatomic, getter=isDisabled, assign) BOOL disabled;
|
||||
@property (nonatomic, assign) XLFormRowNavigationOptions rowNavigationOptions;
|
||||
@property (readonly, nonatomic, nonnull) NSMutableArray * formSections;
|
||||
@property (readonly, nullable) NSString * title;
|
||||
@property (nonatomic) BOOL endEditingTableViewOnScroll;
|
||||
@property (nonatomic) BOOL assignFirstResponderOnShow;
|
||||
@property (nonatomic) BOOL addAsteriskToRequiredRowsTitle;
|
||||
@property (getter=isDisabled) BOOL disabled;
|
||||
@property (nonatomic) XLFormRowNavigationOptions rowNavigationOptions;
|
||||
|
||||
@property (nonatomic, weak, nullable) id<XLFormDescriptorDelegate> delegate;
|
||||
@property (weak, nullable) id<XLFormDescriptorDelegate> delegate;
|
||||
|
||||
+(nonnull instancetype)formDescriptor;
|
||||
+(nonnull instancetype)formDescriptorWithTitle:(nullable NSString *)title;
|
||||
@@ -82,6 +82,7 @@ typedef NS_OPTIONS(NSUInteger, XLFormRowNavigationOptions) {
|
||||
-(nullable NSIndexPath *)indexPathOfFormRow:(nonnull XLFormRowDescriptor *)formRow;
|
||||
|
||||
-(nonnull NSDictionary *)formValues;
|
||||
-(nonnull NSDictionary *)formValuesIncludingHidden;
|
||||
-(nonnull NSDictionary *)httpParameters:(nonnull XLFormViewController *)formViewController;
|
||||
|
||||
-(nonnull NSArray *)localValidationErrors:(nonnull XLFormViewController *)formViewController;
|
||||
|
||||
@@ -32,13 +32,10 @@
|
||||
NSString * const XLFormErrorDomain = @"XLFormErrorDomain";
|
||||
NSString * const XLValidationStatusErrorKey = @"XLValidationStatusErrorKey";
|
||||
|
||||
NSString * const XLFormSectionsKey = @"formSections";
|
||||
|
||||
|
||||
@interface XLFormSectionDescriptor (_XLFormDescriptor)
|
||||
|
||||
@property (nonatomic, weak) NSArray *allRows;
|
||||
|
||||
@property NSArray * allRows;
|
||||
-(BOOL)evaluateIsHidden;
|
||||
|
||||
@end
|
||||
@@ -54,11 +51,11 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
|
||||
@interface XLFormDescriptor()
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray *formSections;
|
||||
@property (nonatomic, strong, readonly) NSMutableArray *allSections;
|
||||
@property (nonatomic, copy ) NSString *title;
|
||||
@property (nonatomic, strong, readonly) NSMutableDictionary *allRowsByTag;
|
||||
@property (atomic , strong) NSMutableDictionary *rowObservers;
|
||||
@property NSMutableArray * formSections;
|
||||
@property (readonly) NSMutableArray * allSections;
|
||||
@property NSString * title;
|
||||
@property (readonly) NSMutableDictionary* allRowsByTag;
|
||||
@property NSMutableDictionary* rowObservers;
|
||||
|
||||
@end
|
||||
|
||||
@@ -66,14 +63,15 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
|
||||
-(instancetype)init
|
||||
{
|
||||
return [self initWithTitle:@""];
|
||||
return [self initWithTitle:nil];
|
||||
}
|
||||
|
||||
-(instancetype)initWithTitle:(NSString *)title;
|
||||
{
|
||||
if (self = [super init]) {
|
||||
self = [super init];
|
||||
if (self){
|
||||
_formSections = [NSMutableArray array];
|
||||
_allSections = [NSMutableArray array];
|
||||
_allSections = [NSMutableArray array];
|
||||
_allRowsByTag = [NSMutableDictionary dictionary];
|
||||
_rowObservers = [NSMutableDictionary dictionary];
|
||||
_title = title;
|
||||
@@ -81,19 +79,14 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
_disabled = NO;
|
||||
_endEditingTableViewOnScroll = YES;
|
||||
_rowNavigationOptions = XLFormRowNavigationOptionEnabled;
|
||||
|
||||
[self addObserver:self
|
||||
forKeyPath:XLFormSectionsKey
|
||||
options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)
|
||||
context:0];
|
||||
[self addObserver:self forKeyPath:@"formSections" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:0];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
+(instancetype)formDescriptor
|
||||
{
|
||||
return [[self class] formDescriptorWithTitle:@""];
|
||||
return [[self class] formDescriptorWithTitle:nil];
|
||||
}
|
||||
|
||||
+(instancetype)formDescriptorWithTitle:(NSString *)title
|
||||
@@ -108,11 +101,11 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
|
||||
-(void)addFormSection:(XLFormSectionDescriptor *)formSection atIndex:(NSUInteger)index
|
||||
{
|
||||
if (index == 0) {
|
||||
if (index == 0){
|
||||
[self insertObject:formSection inAllSectionsAtIndex:0];
|
||||
}
|
||||
else {
|
||||
XLFormSectionDescriptor *previousSection = [self.formSections objectAtIndex:MIN(self.formSections.count, index-1)];
|
||||
else{
|
||||
XLFormSectionDescriptor* previousSection = [self.formSections objectAtIndex:MIN(self.formSections.count, index-1)];
|
||||
[self addFormSection:formSection afterSection:previousSection];
|
||||
}
|
||||
}
|
||||
@@ -121,28 +114,26 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
{
|
||||
NSUInteger sectionIndex;
|
||||
NSUInteger allSectionIndex;
|
||||
if ((sectionIndex = [self.allSections indexOfObject:formSection]) == NSNotFound) {
|
||||
if ((sectionIndex = [self.allSections indexOfObject:formSection]) == NSNotFound){
|
||||
allSectionIndex = [self.allSections indexOfObject:afterSection];
|
||||
if (allSectionIndex != NSNotFound) {
|
||||
[self insertObject:formSection inAllSectionsAtIndex:(allSectionIndex + 1)];
|
||||
}
|
||||
else { //case when afterSection does not exist. Just insert at the end.
|
||||
[self addFormSection:formSection];
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
formSection.hidden = formSection.hidden;
|
||||
}
|
||||
|
||||
|
||||
-(void)addFormRow:(XLFormRowDescriptor *)formRow beforeRow:(XLFormRowDescriptor *)beforeRow
|
||||
{
|
||||
if (beforeRow.sectionDescriptor) {
|
||||
if (beforeRow.sectionDescriptor){
|
||||
[beforeRow.sectionDescriptor addFormRow:formRow beforeRow:beforeRow];
|
||||
}
|
||||
else {
|
||||
else{
|
||||
[[self.allSections lastObject] addFormRow:formRow beforeRow:beforeRow];
|
||||
}
|
||||
}
|
||||
@@ -153,25 +144,27 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
[self addFormRow:formRow beforeRow:beforeRowForm];
|
||||
}
|
||||
|
||||
|
||||
|
||||
-(void)addFormRow:(XLFormRowDescriptor *)formRow afterRow:(XLFormRowDescriptor *)afterRow
|
||||
{
|
||||
if (afterRow.sectionDescriptor) {
|
||||
if (afterRow.sectionDescriptor){
|
||||
[afterRow.sectionDescriptor addFormRow:formRow afterRow:afterRow];
|
||||
}
|
||||
else {
|
||||
else{
|
||||
[[self.allSections lastObject] addFormRow:formRow afterRow:afterRow];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)addFormRow:(XLFormRowDescriptor *)formRow afterRowTag:(NSString *)afterRowTag
|
||||
{
|
||||
XLFormRowDescriptor *afterRowForm = [self formRowWithTag:afterRowTag];
|
||||
XLFormRowDescriptor * afterRowForm = [self formRowWithTag:afterRowTag];
|
||||
[self addFormRow:formRow afterRow:afterRowForm];
|
||||
}
|
||||
|
||||
-(void)removeFormSectionAtIndex:(NSUInteger)index
|
||||
{
|
||||
if (self.formSections.count > index) {
|
||||
if (self.formSections.count > index){
|
||||
XLFormSectionDescriptor *formSection = [self.formSections objectAtIndex:index];
|
||||
[self removeObjectFromFormSectionsAtIndex:index];
|
||||
NSUInteger allSectionIndex = [self.allSections indexOfObject:formSection];
|
||||
@@ -182,47 +175,43 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
-(void)removeFormSection:(XLFormSectionDescriptor *)formSection
|
||||
{
|
||||
NSUInteger index = NSNotFound;
|
||||
if ((index = [self.formSections indexOfObject:formSection]) != NSNotFound) {
|
||||
if ((index = [self.formSections indexOfObject:formSection]) != NSNotFound){
|
||||
[self removeFormSectionAtIndex:index];
|
||||
}
|
||||
if ((index = [self.allSections indexOfObject:formSection]) != NSNotFound) {
|
||||
else if ((index = [self.allSections indexOfObject:formSection]) != NSNotFound){
|
||||
[self removeObjectFromAllSectionsAtIndex:index];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
-(void)removeFormRow:(XLFormRowDescriptor *)formRow
|
||||
{
|
||||
for (XLFormSectionDescriptor *section in self.formSections) {
|
||||
if ([section.formRows containsObject:formRow]) {
|
||||
for (XLFormSectionDescriptor * section in self.formSections){
|
||||
if ([section.formRows containsObject:formRow]){
|
||||
[section removeFormRow:formRow];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)showFormSection:(XLFormSectionDescriptor *)formSection
|
||||
-(void)showFormSection:(XLFormSectionDescriptor*)formSection
|
||||
{
|
||||
NSUInteger formIndex = [self.formSections indexOfObject:formSection];
|
||||
if (formIndex != NSNotFound) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSUInteger index = [self.allSections indexOfObject:formSection];
|
||||
if (index != NSNotFound) {
|
||||
if (index != NSNotFound){
|
||||
while (formIndex == NSNotFound && index > 0) {
|
||||
XLFormSectionDescriptor* previous = [self.allSections objectAtIndex:--index];
|
||||
formIndex = [self.formSections indexOfObject:previous];
|
||||
}
|
||||
|
||||
[self insertObject:formSection inFormSectionsAtIndex:(formIndex == NSNotFound ? 0 : ++formIndex)];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)hideFormSection:(XLFormSectionDescriptor *)formSection
|
||||
-(void)hideFormSection:(XLFormSectionDescriptor*)formSection
|
||||
{
|
||||
NSUInteger index = [self.formSections indexOfObject:formSection];
|
||||
if (index != NSNotFound) {
|
||||
if (index != NSNotFound){
|
||||
[self removeObjectFromFormSectionsAtIndex:index];
|
||||
}
|
||||
}
|
||||
@@ -235,29 +224,28 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
|
||||
-(XLFormRowDescriptor *)formRowWithHash:(NSUInteger)hash
|
||||
{
|
||||
for (XLFormSectionDescriptor *section in self.allSections) {
|
||||
for (XLFormRowDescriptor *row in section.allRows) {
|
||||
if ([row hash] == hash) {
|
||||
for (XLFormSectionDescriptor * section in self.allSections){
|
||||
for (XLFormRowDescriptor * row in section.allRows) {
|
||||
if ([row hash] == hash){
|
||||
return row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
-(void)removeFormRowWithTag:(NSString *)tag
|
||||
{
|
||||
XLFormRowDescriptor *formRow = [self formRowWithTag:tag];
|
||||
XLFormRowDescriptor * formRow = [self formRowWithTag:tag];
|
||||
[self removeFormRow:formRow];
|
||||
}
|
||||
|
||||
-(XLFormRowDescriptor *)formRowAtIndex:(NSIndexPath *)indexPath
|
||||
{
|
||||
if ((self.formSections.count > indexPath.section) && [[self.formSections objectAtIndex:indexPath.section] formRows].count > indexPath.row) {
|
||||
if ((self.formSections.count > indexPath.section) && [[self.formSections objectAtIndex:indexPath.section] formRows].count > indexPath.row){
|
||||
return [[[self.formSections objectAtIndex:indexPath.section] formRows] objectAtIndex:indexPath.row];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -268,62 +256,67 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
|
||||
-(NSIndexPath *)indexPathOfFormRow:(XLFormRowDescriptor *)formRow
|
||||
{
|
||||
NSIndexPath *result = nil;
|
||||
XLFormSectionDescriptor *section = formRow.sectionDescriptor;
|
||||
if (section) {
|
||||
XLFormSectionDescriptor * section = formRow.sectionDescriptor;
|
||||
if (section){
|
||||
NSUInteger sectionIndex = [self.formSections indexOfObject:section];
|
||||
if (sectionIndex != NSNotFound) {
|
||||
if (sectionIndex != NSNotFound){
|
||||
NSUInteger rowIndex = [section.formRows indexOfObject:formRow];
|
||||
if (rowIndex != NSNotFound) {
|
||||
result = [NSIndexPath indexPathForRow:rowIndex inSection:sectionIndex];
|
||||
if (rowIndex != NSNotFound){
|
||||
return [NSIndexPath indexPathForRow:rowIndex inSection:sectionIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(NSIndexPath *)globalIndexPathOfFormRow:(XLFormRowDescriptor *)formRow
|
||||
{
|
||||
NSIndexPath *result = nil;
|
||||
XLFormSectionDescriptor *section = formRow.sectionDescriptor;
|
||||
if (section) {
|
||||
XLFormSectionDescriptor * section = formRow.sectionDescriptor;
|
||||
if (section){
|
||||
NSUInteger sectionIndex = [self.allSections indexOfObject:section];
|
||||
if (sectionIndex != NSNotFound) {
|
||||
if (sectionIndex != NSNotFound){
|
||||
NSUInteger rowIndex = [section.allRows indexOfObject:formRow];
|
||||
if (rowIndex != NSNotFound) {
|
||||
result = [NSIndexPath indexPathForRow:rowIndex inSection:sectionIndex];
|
||||
if (rowIndex != NSNotFound){
|
||||
return [NSIndexPath indexPathForRow:rowIndex inSection:sectionIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(NSDictionary *)formValuesIncludingHidden
|
||||
{
|
||||
return [self formValuesWithHidden:YES];
|
||||
}
|
||||
|
||||
-(NSDictionary *)formValues
|
||||
{
|
||||
NSMutableDictionary *result = [NSMutableDictionary dictionary];
|
||||
for (XLFormSectionDescriptor *section in self.formSections) {
|
||||
if (section.multivaluedTag.length > 0) {
|
||||
NSMutableArray *multiValuedValuesArray = [NSMutableArray new];
|
||||
for (XLFormRowDescriptor *row in section.formRows) {
|
||||
if (row.value && row.value != [NSNull null]) {
|
||||
return [self formValuesWithHidden:NO];
|
||||
}
|
||||
|
||||
-(NSDictionary *)formValuesWithHidden:(BOOL)includeHidden
|
||||
{
|
||||
NSArray* sections = includeHidden ? self.allSections : self.formSections;
|
||||
NSMutableDictionary* result = [NSMutableDictionary dictionary];
|
||||
for (XLFormSectionDescriptor * section in sections) {
|
||||
NSArray* rows = includeHidden ? section.allRows : section.formRows;
|
||||
if (section.multivaluedTag.length > 0){
|
||||
NSMutableArray* multiValuedValuesArray = [NSMutableArray new];
|
||||
for (XLFormRowDescriptor * row in rows) {
|
||||
if (row.value){
|
||||
[multiValuedValuesArray addObject:row.value];
|
||||
}
|
||||
}
|
||||
|
||||
[result setObject:multiValuedValuesArray forKey:section.multivaluedTag];
|
||||
}
|
||||
else {
|
||||
for (XLFormRowDescriptor *row in section.formRows) {
|
||||
id value = [row.value valueData];
|
||||
if (row.tag.length > 0 && value != nil) {
|
||||
[result setObject:value forKey:row.tag];
|
||||
else{
|
||||
for (XLFormRowDescriptor * row in rows) {
|
||||
if (row.tag.length > 0){
|
||||
[result setObject:(row.value ?: [NSNull null]) forKey:row.tag];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -331,55 +324,49 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
{
|
||||
NSMutableDictionary * result = [NSMutableDictionary dictionary];
|
||||
for (XLFormSectionDescriptor * section in self.formSections) {
|
||||
if (section.multivaluedTag.length > 0) {
|
||||
NSMutableArray *multiValuedValuesArray = [NSMutableArray new];
|
||||
if (section.multivaluedTag.length > 0){
|
||||
NSMutableArray * multiValuedValuesArray = [NSMutableArray new];
|
||||
for (XLFormRowDescriptor * row in section.formRows) {
|
||||
if ([row.value valueData]) {
|
||||
if ([row.value valueData]){
|
||||
[multiValuedValuesArray addObject:[row.value valueData]];
|
||||
}
|
||||
}
|
||||
|
||||
[result setObject:multiValuedValuesArray forKey:section.multivaluedTag];
|
||||
}
|
||||
else {
|
||||
else{
|
||||
for (XLFormRowDescriptor * row in section.formRows) {
|
||||
NSString *httpParameterKey = nil;
|
||||
if ((httpParameterKey = [self httpParameterKeyForRow:row cell:[row cellForFormController:formViewController]])) {
|
||||
NSString * httpParameterKey = nil;
|
||||
if ((httpParameterKey = [self httpParameterKeyForRow:row cell:[row cellForFormController:formViewController]])){
|
||||
id parameterValue = [row.value valueData] ?: [NSNull null];
|
||||
[result setObject:parameterValue forKey:httpParameterKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
-(NSString *)httpParameterKeyForRow:(XLFormRowDescriptor *)row cell:(UITableViewCell<XLFormDescriptorCell> *)descriptorCell
|
||||
{
|
||||
NSString *result = nil;
|
||||
|
||||
if ([descriptorCell respondsToSelector:@selector(formDescriptorHttpParameterName)]) {
|
||||
result = [descriptorCell formDescriptorHttpParameterName];
|
||||
if ([descriptorCell respondsToSelector:@selector(formDescriptorHttpParameterName)]){
|
||||
return [descriptorCell formDescriptorHttpParameterName];
|
||||
}
|
||||
else if (row.tag.length > 0) {
|
||||
result = row.tag;
|
||||
if (row.tag.length > 0){
|
||||
return row.tag;
|
||||
}
|
||||
|
||||
return result;
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(NSArray *)localValidationErrors:(XLFormViewController *)formViewController
|
||||
{
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
for (XLFormSectionDescriptor *section in self.formSections) {
|
||||
for (XLFormRowDescriptor *row in section.formRows) {
|
||||
XLFormValidationStatus *status = [row doValidation];
|
||||
-(NSArray *)localValidationErrors:(XLFormViewController *)formViewController {
|
||||
NSMutableArray * result = [NSMutableArray array];
|
||||
for (XLFormSectionDescriptor * section in self.formSections) {
|
||||
for (XLFormRowDescriptor * row in section.formRows) {
|
||||
XLFormValidationStatus* status = [row doValidation];
|
||||
if (status != nil && (![status isValid])) {
|
||||
NSDictionary *userInfo = @{ NSLocalizedDescriptionKey: status.msg,
|
||||
XLValidationStatusErrorKey: status };
|
||||
NSError *error = [[NSError alloc] initWithDomain:XLFormErrorDomain code:XLFormErrorCodeGen userInfo:userInfo];
|
||||
if (error) {
|
||||
NSError * error = [[NSError alloc] initWithDomain:XLFormErrorDomain code:XLFormErrorCodeGen userInfo:userInfo];
|
||||
if (error){
|
||||
[result addObject:error];
|
||||
}
|
||||
}
|
||||
@@ -392,11 +379,11 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
|
||||
- (void)setFirstResponder:(XLFormViewController *)formViewController
|
||||
{
|
||||
for (XLFormSectionDescriptor *formSection in self.formSections) {
|
||||
for (XLFormRowDescriptor *row in formSection.formRows) {
|
||||
UITableViewCell<XLFormDescriptorCell> *cell = [row cellForFormController:formViewController];
|
||||
if ([cell formDescriptorCellCanBecomeFirstResponder]) {
|
||||
if ([cell formDescriptorCellBecomeFirstResponder]) {
|
||||
for (XLFormSectionDescriptor * formSection in self.formSections) {
|
||||
for (XLFormRowDescriptor * row in formSection.formRows) {
|
||||
UITableViewCell<XLFormDescriptorCell> * cell = [row cellForFormController:formViewController];
|
||||
if ([cell formDescriptorCellCanBecomeFirstResponder]){
|
||||
if ([cell formDescriptorCellBecomeFirstResponder]){
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -407,23 +394,18 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
|
||||
#pragma mark - KVO
|
||||
|
||||
- (void)observeValueForKeyPath:(nullable NSString *)keyPath
|
||||
ofObject:(nullable id)object
|
||||
change:(nullable NSDictionary<NSKeyValueChangeKey, id> *)change
|
||||
context:(nullable void *)context
|
||||
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
||||
{
|
||||
if (!self.delegate) {
|
||||
return;
|
||||
}
|
||||
else if ([keyPath isEqualToString:XLFormSectionsKey]) {
|
||||
if ([[change objectForKey:NSKeyValueChangeKindKey] isEqualToNumber:@(NSKeyValueChangeInsertion)]) {
|
||||
NSIndexSet *indexSet = [change objectForKey:NSKeyValueChangeIndexesKey];
|
||||
XLFormSectionDescriptor *section = [self.formSections objectAtIndex:indexSet.firstIndex];
|
||||
if (!self.delegate) return;
|
||||
if ([keyPath isEqualToString:@"formSections"]){
|
||||
if ([[change objectForKey:NSKeyValueChangeKindKey] isEqualToNumber:@(NSKeyValueChangeInsertion)]){
|
||||
NSIndexSet * indexSet = [change objectForKey:NSKeyValueChangeIndexesKey];
|
||||
XLFormSectionDescriptor * section = [self.formSections objectAtIndex:indexSet.firstIndex];
|
||||
[self.delegate formSectionHasBeenAdded:section atIndex:indexSet.firstIndex];
|
||||
}
|
||||
else if ([[change objectForKey:NSKeyValueChangeKindKey] isEqualToNumber:@(NSKeyValueChangeRemoval)]) {
|
||||
NSIndexSet *indexSet = [change objectForKey:NSKeyValueChangeIndexesKey];
|
||||
XLFormSectionDescriptor *removedSection = [[change objectForKey:NSKeyValueChangeOldKey] objectAtIndex:0];
|
||||
else if ([[change objectForKey:NSKeyValueChangeKindKey] isEqualToNumber:@(NSKeyValueChangeRemoval)]){
|
||||
NSIndexSet * indexSet = [change objectForKey:NSKeyValueChangeIndexesKey];
|
||||
XLFormSectionDescriptor * removedSection = [[change objectForKey:NSKeyValueChangeOldKey] objectAtIndex:0];
|
||||
[self.delegate formSectionHasBeenRemoved:removedSection atIndex:indexSet.firstIndex];
|
||||
}
|
||||
}
|
||||
@@ -431,16 +413,10 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
|
||||
-(void)dealloc
|
||||
{
|
||||
[self removeObserver:self forKeyPath:XLFormSectionsKey];
|
||||
|
||||
[_formSections removeAllObjects];
|
||||
_formSections = nil;
|
||||
[_allSections removeAllObjects];
|
||||
_allSections = nil;
|
||||
[_allRowsByTag removeAllObjects];
|
||||
_allRowsByTag = nil;
|
||||
[_rowObservers removeAllObjects];
|
||||
_rowObservers = nil;
|
||||
@try {
|
||||
[self removeObserver:self forKeyPath:@"formSections"];
|
||||
}
|
||||
@catch (NSException * __unused exception) {}
|
||||
}
|
||||
|
||||
#pragma mark - KVC
|
||||
@@ -450,23 +426,19 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
return self.formSections.count;
|
||||
}
|
||||
|
||||
- (id)objectInFormSectionsAtIndex:(NSUInteger)index
|
||||
{
|
||||
- (id)objectInFormSectionsAtIndex:(NSUInteger)index {
|
||||
return [self.formSections objectAtIndex:index];
|
||||
}
|
||||
|
||||
- (NSArray *)formSectionsAtIndexes:(NSIndexSet *)indexes
|
||||
{
|
||||
- (NSArray *)formSectionsAtIndexes:(NSIndexSet *)indexes {
|
||||
return [self.formSections objectsAtIndexes:indexes];
|
||||
}
|
||||
|
||||
- (void)insertObject:(XLFormSectionDescriptor *)formSection inFormSectionsAtIndex:(NSUInteger)index
|
||||
{
|
||||
- (void)insertObject:(XLFormSectionDescriptor *)formSection inFormSectionsAtIndex:(NSUInteger)index {
|
||||
[self.formSections insertObject:formSection atIndex:index];
|
||||
}
|
||||
|
||||
- (void)removeObjectFromFormSectionsAtIndex:(NSUInteger)index
|
||||
{
|
||||
- (void)removeObjectFromFormSectionsAtIndex:(NSUInteger)index {
|
||||
[self.formSections removeObjectAtIndex:index];
|
||||
}
|
||||
|
||||
@@ -485,8 +457,7 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
return [self.allSections objectsAtIndexes:indexes];
|
||||
}
|
||||
|
||||
- (void)removeObjectFromAllSectionsAtIndex:(NSUInteger)index
|
||||
{
|
||||
- (void)removeObjectFromAllSectionsAtIndex:(NSUInteger)index {
|
||||
XLFormSectionDescriptor* section = [self.allSections objectAtIndex:index];
|
||||
[section.allRows enumerateObjectsUsingBlock:^(id obj, NSUInteger __unused idx, BOOL *stop) {
|
||||
XLFormRowDescriptor * row = (id)obj;
|
||||
@@ -497,8 +468,7 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
[self.allSections removeObjectAtIndex:index];
|
||||
}
|
||||
|
||||
- (void)insertObject:(XLFormSectionDescriptor *)section inAllSectionsAtIndex:(NSUInteger)index
|
||||
{
|
||||
- (void)insertObject:(XLFormSectionDescriptor *)section inAllSectionsAtIndex:(NSUInteger)index {
|
||||
section.formDescriptor = self;
|
||||
[self.allSections insertObject:section atIndex:index];
|
||||
section.hidden = section.hidden;
|
||||
@@ -508,23 +478,24 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
row.hidden = row.hidden;
|
||||
row.disabled = row.disabled;
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - EvaluateForm
|
||||
|
||||
-(void)forceEvaluate
|
||||
{
|
||||
for (XLFormSectionDescriptor *section in self.allSections) {
|
||||
for (XLFormRowDescriptor *row in section.allRows) {
|
||||
for (XLFormSectionDescriptor* section in self.allSections){
|
||||
for (XLFormRowDescriptor* row in section.allRows) {
|
||||
[self addRowToTagCollection:row];
|
||||
}
|
||||
}
|
||||
for (XLFormSectionDescriptor *section in self.allSections) {
|
||||
for (XLFormRowDescriptor *row in section.allRows) {
|
||||
for (XLFormSectionDescriptor* section in self.allSections){
|
||||
for (XLFormRowDescriptor* row in section.allRows) {
|
||||
[row evaluateIsDisabled];
|
||||
[row evaluateIsHidden];
|
||||
}
|
||||
|
||||
[section evaluateIsHidden];
|
||||
}
|
||||
}
|
||||
@@ -541,65 +512,60 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
|
||||
-(XLFormRowDescriptor *)nextRowDescriptorForRow:(XLFormRowDescriptor *)row
|
||||
{
|
||||
XLFormRowDescriptor *result = nil;
|
||||
NSUInteger indexOfRow = [row.sectionDescriptor.formRows indexOfObject:row];
|
||||
if (indexOfRow != NSNotFound) {
|
||||
if (indexOfRow + 1 < row.sectionDescriptor.formRows.count) {
|
||||
result = [row.sectionDescriptor.formRows objectAtIndex:++indexOfRow];
|
||||
if (indexOfRow != NSNotFound){
|
||||
if (indexOfRow + 1 < row.sectionDescriptor.formRows.count){
|
||||
return [row.sectionDescriptor.formRows objectAtIndex:++indexOfRow];
|
||||
}
|
||||
else {
|
||||
else{
|
||||
NSUInteger sectionIndex = [self.formSections indexOfObject:row.sectionDescriptor];
|
||||
NSUInteger numberOfSections = [self.formSections count];
|
||||
if (sectionIndex != NSNotFound && sectionIndex < numberOfSections - 1) {
|
||||
if (sectionIndex != NSNotFound && sectionIndex < numberOfSections - 1){
|
||||
sectionIndex++;
|
||||
XLFormSectionDescriptor *sectionDescriptor;
|
||||
while ([[(sectionDescriptor = [row.sectionDescriptor.formDescriptor.formSections objectAtIndex:sectionIndex]) formRows] count] == 0 && sectionIndex < numberOfSections - 1) {
|
||||
XLFormSectionDescriptor * sectionDescriptor;
|
||||
while ([[(sectionDescriptor = [row.sectionDescriptor.formDescriptor.formSections objectAtIndex:sectionIndex]) formRows] count] == 0 && sectionIndex < numberOfSections - 1){
|
||||
sectionIndex++;
|
||||
}
|
||||
|
||||
result = [sectionDescriptor.formRows firstObject];
|
||||
return [sectionDescriptor.formRows firstObject];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
-(XLFormRowDescriptor *)previousRowDescriptorForRow:(XLFormRowDescriptor *)row
|
||||
{
|
||||
XLFormRowDescriptor *result = nil;
|
||||
NSUInteger indexOfRow = [row.sectionDescriptor.formRows indexOfObject:row];
|
||||
if (indexOfRow != NSNotFound) {
|
||||
if (indexOfRow > 0 ) {
|
||||
result = [row.sectionDescriptor.formRows objectAtIndex:--indexOfRow];
|
||||
if (indexOfRow != NSNotFound){
|
||||
if (indexOfRow > 0 ){
|
||||
return [row.sectionDescriptor.formRows objectAtIndex:--indexOfRow];
|
||||
}
|
||||
else {
|
||||
else{
|
||||
NSUInteger sectionIndex = [self.formSections indexOfObject:row.sectionDescriptor];
|
||||
if (sectionIndex != NSNotFound && sectionIndex > 0) {
|
||||
if (sectionIndex != NSNotFound && sectionIndex > 0){
|
||||
sectionIndex--;
|
||||
XLFormSectionDescriptor * sectionDescriptor;
|
||||
while ([[(sectionDescriptor = [row.sectionDescriptor.formDescriptor.formSections objectAtIndex:sectionIndex]) formRows] count] == 0 && sectionIndex > 0 ) {
|
||||
while ([[(sectionDescriptor = [row.sectionDescriptor.formDescriptor.formSections objectAtIndex:sectionIndex]) formRows] count] == 0 && sectionIndex > 0 ){
|
||||
sectionIndex--;
|
||||
}
|
||||
result = [sectionDescriptor.formRows lastObject];
|
||||
return [sectionDescriptor.formRows lastObject];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(void)addRowToTagCollection:(XLFormRowDescriptor *)rowDescriptor
|
||||
-(void)addRowToTagCollection:(XLFormRowDescriptor*) rowDescriptor
|
||||
{
|
||||
if (rowDescriptor.tag.length) {
|
||||
if (rowDescriptor.tag) {
|
||||
self.allRowsByTag[rowDescriptor.tag] = rowDescriptor;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)removeRowFromTagCollection:(XLFormRowDescriptor *)rowDescriptor
|
||||
{
|
||||
if (rowDescriptor.tag.length) {
|
||||
if (rowDescriptor.tag){
|
||||
[self.allRowsByTag removeObjectForKey:rowDescriptor.tag];
|
||||
}
|
||||
}
|
||||
@@ -607,36 +573,32 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
|
||||
-(void)addObserversOfObject:(id)sectionOrRow predicateType:(XLPredicateType)predicateType
|
||||
{
|
||||
NSPredicate *predicate;
|
||||
NSPredicate* predicate;
|
||||
id descriptor;
|
||||
|
||||
switch (predicateType) {
|
||||
switch(predicateType){
|
||||
case XLPredicateTypeHidden:
|
||||
if ([sectionOrRow isKindOfClass:([XLFormRowDescriptor class])]) {
|
||||
descriptor = ((XLFormRowDescriptor *)sectionOrRow).tag;
|
||||
predicate = ((XLFormRowDescriptor *)sectionOrRow).hidden;
|
||||
descriptor = ((XLFormRowDescriptor*)sectionOrRow).tag;
|
||||
predicate = ((XLFormRowDescriptor*)sectionOrRow).hidden;
|
||||
}
|
||||
else if ([sectionOrRow isKindOfClass:([XLFormSectionDescriptor class])]) {
|
||||
descriptor = sectionOrRow;
|
||||
predicate = ((XLFormSectionDescriptor *)sectionOrRow).hidden;
|
||||
predicate = ((XLFormSectionDescriptor*)sectionOrRow).hidden;
|
||||
}
|
||||
break;
|
||||
case XLPredicateTypeDisabled:
|
||||
if ([sectionOrRow isKindOfClass:([XLFormRowDescriptor class])]) {
|
||||
descriptor = ((XLFormRowDescriptor *)sectionOrRow).tag;
|
||||
predicate = ((XLFormRowDescriptor *)sectionOrRow).disabled;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
descriptor = ((XLFormRowDescriptor*)sectionOrRow).tag;
|
||||
predicate = ((XLFormRowDescriptor*)sectionOrRow).disabled;
|
||||
}
|
||||
else return;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
NSMutableArray *tags = [predicate getPredicateVars];
|
||||
for (NSString *tag in tags) {
|
||||
NSString *auxTag = [tag formKeyForPredicateType:predicateType];
|
||||
if (!self.rowObservers[auxTag]) {
|
||||
NSMutableArray* tags = [predicate getPredicateVars];
|
||||
for (NSString* tag in tags) {
|
||||
NSString* auxTag = [tag formKeyForPredicateType:predicateType];
|
||||
if (!self.rowObservers[auxTag]){
|
||||
self.rowObservers[auxTag] = [NSMutableArray array];
|
||||
}
|
||||
if (![self.rowObservers[auxTag] containsObject:descriptor])
|
||||
@@ -647,32 +609,31 @@ NSString * const XLFormSectionsKey = @"formSections";
|
||||
|
||||
-(void)removeObserversOfObject:(id)sectionOrRow predicateType:(XLPredicateType)predicateType
|
||||
{
|
||||
NSPredicate *predicate;
|
||||
NSPredicate* predicate;
|
||||
id descriptor;
|
||||
|
||||
switch(predicateType) {
|
||||
switch(predicateType){
|
||||
case XLPredicateTypeHidden:
|
||||
if ([sectionOrRow isKindOfClass:([XLFormRowDescriptor class])]) {
|
||||
descriptor = ((XLFormRowDescriptor *)sectionOrRow).tag;
|
||||
predicate = ((XLFormRowDescriptor *)sectionOrRow).hidden;
|
||||
descriptor = ((XLFormRowDescriptor*)sectionOrRow).tag;
|
||||
predicate = ((XLFormRowDescriptor*)sectionOrRow).hidden;
|
||||
}
|
||||
else if ([sectionOrRow isKindOfClass:([XLFormSectionDescriptor class])]) {
|
||||
descriptor = sectionOrRow;
|
||||
predicate = ((XLFormSectionDescriptor *)sectionOrRow).hidden;
|
||||
predicate = ((XLFormSectionDescriptor*)sectionOrRow).hidden;
|
||||
}
|
||||
break;
|
||||
case XLPredicateTypeDisabled:
|
||||
if ([sectionOrRow isKindOfClass:([XLFormRowDescriptor class])]) {
|
||||
descriptor = ((XLFormRowDescriptor *)sectionOrRow).tag;
|
||||
predicate = ((XLFormRowDescriptor *)sectionOrRow).disabled;
|
||||
descriptor = ((XLFormRowDescriptor*)sectionOrRow).tag;
|
||||
predicate = ((XLFormRowDescriptor*)sectionOrRow).disabled;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (descriptor && [predicate isKindOfClass:[NSPredicate class]]) {
|
||||
NSMutableArray *tags = [predicate getPredicateVars];
|
||||
for (NSString *tag in tags) {
|
||||
NSString *auxTag = [tag formKeyForPredicateType:predicateType];
|
||||
if (self.rowObservers[auxTag]) {
|
||||
if (descriptor && [predicate isKindOfClass:[NSPredicate class] ]) {
|
||||
NSMutableArray* tags = [predicate getPredicateVars];
|
||||
for (NSString* tag in tags) {
|
||||
NSString* auxTag = [tag formKeyForPredicateType:predicateType];
|
||||
if (self.rowObservers[auxTag]){
|
||||
[self.rowObservers[auxTag] removeObject:descriptor];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,22 +43,22 @@ typedef NS_ENUM(NSUInteger, XLFormPresentationMode) {
|
||||
XLFormPresentationModePresent
|
||||
};
|
||||
|
||||
typedef void(^XLOnChangeBlock)(id __nullable oldValue, id __nullable newValue, XLFormRowDescriptor * __nonnull rowDescriptor);
|
||||
typedef void(^XLOnChangeBlock)(id __nullable oldValue,id __nullable newValue,XLFormRowDescriptor* __nonnull rowDescriptor);
|
||||
|
||||
@interface XLFormRowDescriptor : NSObject
|
||||
|
||||
@property (nonatomic, nullable, strong) id cellClass;
|
||||
@property (nonatomic, nullable, copy , readwrite) NSString * tag;
|
||||
@property (nonatomic, nonnull , copy , readonly) NSString * rowType;
|
||||
@property (nonatomic, nullable, copy ) NSString * title;
|
||||
@property (nonatomic, nullable, strong) id value;
|
||||
@property (nonatomic, nullable, strong) Class valueTransformer;
|
||||
@property (nonatomic, assign ) UITableViewCellStyle cellStyle;
|
||||
@property (nonatomic, assign ) CGFloat height;
|
||||
@property (nullable) id cellClass;
|
||||
@property (readwrite, nullable) NSString * tag;
|
||||
@property (readonly, nonnull) NSString * rowType;
|
||||
@property (nullable) NSString * title;
|
||||
@property (nonatomic, nullable) id value;
|
||||
@property (nullable) Class valueTransformer;
|
||||
@property UITableViewCellStyle cellStyle;
|
||||
@property (nonatomic) CGFloat height;
|
||||
|
||||
@property (nonatomic, copy , nullable) XLOnChangeBlock onChangeBlock;
|
||||
@property (nonatomic, assign) BOOL useValueFormatterDuringInput;
|
||||
@property (nonatomic, strong, nullable) NSFormatter *valueFormatter;
|
||||
@property (copy, nullable) XLOnChangeBlock onChangeBlock;
|
||||
@property BOOL useValueFormatterDuringInput;
|
||||
@property (nullable) NSFormatter *valueFormatter;
|
||||
|
||||
// returns the display text for the row descriptor, taking into account NSFormatters and default placeholder values
|
||||
- (nonnull NSString *) displayTextValue;
|
||||
@@ -66,22 +66,20 @@ typedef void(^XLOnChangeBlock)(id __nullable oldValue, id __nullable newValue, X
|
||||
// returns the editing text value for the row descriptor, taking into account NSFormatters.
|
||||
- (nonnull NSString *) editTextValue;
|
||||
|
||||
@property (nonatomic, readonly, nonnull, strong) NSMutableDictionary * cellConfig;
|
||||
@property (nonatomic, readonly, nonnull, strong) NSMutableDictionary * cellConfigForSelector;
|
||||
@property (nonatomic, readonly, nonnull, strong) NSMutableDictionary * cellConfigIfDisabled;
|
||||
@property (nonatomic, readonly, nonnull, strong) NSMutableDictionary * cellConfigAtConfigure;
|
||||
@property (nonatomic, readonly, nonnull) NSMutableDictionary * cellConfig;
|
||||
@property (nonatomic, readonly, nonnull) NSMutableDictionary * cellConfigForSelector;
|
||||
@property (nonatomic, readonly, nonnull) NSMutableDictionary * cellConfigIfDisabled;
|
||||
@property (nonatomic, readonly, nonnull) NSMutableDictionary * cellConfigAtConfigure;
|
||||
|
||||
@property (nonatomic, nonnull, strong) id disabled;
|
||||
@property (nonnull) id disabled;
|
||||
-(BOOL)isDisabled;
|
||||
|
||||
@property (nonatomic, nonnull, strong) id hidden;
|
||||
@property (nonnull) id hidden;
|
||||
-(BOOL)isHidden;
|
||||
@property (getter=isRequired) BOOL required;
|
||||
|
||||
@property (getter=isRequired, nonatomic, assign) BOOL required;
|
||||
@property (nonnull) XLFormAction * action;
|
||||
|
||||
@property (nonatomic, nonnull, strong) XLFormAction * action;
|
||||
|
||||
@property (nonatomic, weak, null_unspecified) XLFormSectionDescriptor * sectionDescriptor;
|
||||
@property (weak, null_unspecified) XLFormSectionDescriptor * sectionDescriptor;
|
||||
|
||||
+(nonnull instancetype)formRowDescriptorWithTag:(nullable NSString *)tag rowType:(nonnull NSString *)rowType;
|
||||
+(nonnull instancetype)formRowDescriptorWithTag:(nullable NSString *)tag rowType:(nonnull NSString *)rowType title:(nullable NSString *)title;
|
||||
@@ -89,7 +87,7 @@ typedef void(^XLOnChangeBlock)(id __nullable oldValue, id __nullable newValue, X
|
||||
|
||||
-(nonnull XLFormBaseCell *)cellForFormController:(nonnull XLFormViewController *)formController;
|
||||
|
||||
@property (nonatomic, nullable, copy) NSString *requireMsg;
|
||||
@property (nullable) NSString *requireMsg;
|
||||
-(void)addValidator:(nonnull id<XLFormValidatorProtocol>)validator;
|
||||
-(void)removeValidator:(nonnull id<XLFormValidatorProtocol>)validator;
|
||||
-(nullable XLFormValidationStatus *)doValidation;
|
||||
@@ -97,9 +95,9 @@ typedef void(^XLOnChangeBlock)(id __nullable oldValue, id __nullable newValue, X
|
||||
// ===========================
|
||||
// property used for Selectors
|
||||
// ===========================
|
||||
@property (nonatomic, nullable, copy) NSString * noValueDisplayText;
|
||||
@property (nonatomic, nullable, copy) NSString * selectorTitle;
|
||||
@property (nonatomic, nullable, strong) NSArray * selectorOptions;
|
||||
@property (nullable) NSString * noValueDisplayText;
|
||||
@property (nullable) NSString * selectorTitle;
|
||||
@property (nullable) NSArray * selectorOptions;
|
||||
|
||||
@property (null_unspecified) id leftRightSelectorLeftOptionSelected;
|
||||
|
||||
@@ -128,13 +126,13 @@ typedef NS_ENUM(NSUInteger, XLFormLeftRightSelectorOptionLeftValueChangePolicy)
|
||||
@interface XLFormLeftRightSelectorOption : NSObject
|
||||
|
||||
@property (nonatomic, assign) XLFormLeftRightSelectorOptionLeftValueChangePolicy leftValueChangePolicy;
|
||||
@property (nonatomic, readonly, nonnull) id leftValue;
|
||||
@property (nonatomic, readonly, nonnull) NSArray * rightOptions;
|
||||
@property (nonatomic, readonly, null_unspecified, copy) NSString * httpParameterKey;
|
||||
@property (nonatomic, nullable) Class rightSelectorControllerClass;
|
||||
@property (readonly, nonnull) id leftValue;
|
||||
@property (readonly, nonnull) NSArray * rightOptions;
|
||||
@property (readonly, null_unspecified) NSString * httpParameterKey;
|
||||
@property (nullable) Class rightSelectorControllerClass;
|
||||
|
||||
@property (nonatomic, nullable, copy) NSString * noValueDisplayText;
|
||||
@property (nonatomic, nullable, copy) NSString * selectorTitle;
|
||||
@property (nullable) NSString * noValueDisplayText;
|
||||
@property (nullable) NSString * selectorTitle;
|
||||
|
||||
|
||||
+(nonnull XLFormLeftRightSelectorOption *)formLeftRightSelectorOptionWithLeftValue:(nonnull id)leftValue
|
||||
@@ -156,16 +154,16 @@ typedef NS_ENUM(NSUInteger, XLFormLeftRightSelectorOptionLeftValueChangePolicy)
|
||||
|
||||
@interface XLFormAction : NSObject
|
||||
|
||||
@property (nullable, nonatomic) Class viewControllerClass;
|
||||
@property (nullable, nonatomic, copy) NSString * viewControllerStoryboardId;
|
||||
@property (nullable, nonatomic, copy) NSString * viewControllerNibName;
|
||||
@property (nullable, nonatomic, strong) Class viewControllerClass;
|
||||
@property (nullable, nonatomic, strong) NSString * viewControllerStoryboardId;
|
||||
@property (nullable, nonatomic, strong) NSString * viewControllerNibName;
|
||||
|
||||
@property (nonatomic, assign) XLFormPresentationMode viewControllerPresentationMode;
|
||||
@property (nonatomic) XLFormPresentationMode viewControllerPresentationMode;
|
||||
|
||||
@property (nullable, nonatomic, copy) void (^formBlock)(XLFormRowDescriptor * __nonnull sender);
|
||||
@property (nullable, nonatomic, strong) void (^formBlock)(XLFormRowDescriptor * __nonnull sender);
|
||||
@property (nullable, nonatomic) SEL formSelector;
|
||||
@property (nullable, nonatomic, copy) NSString * formSegueIdenfifier DEPRECATED_ATTRIBUTE DEPRECATED_MSG_ATTRIBUTE("Use formSegueIdentifier instead");
|
||||
@property (nullable, nonatomic, copy) NSString * formSegueIdentifier;
|
||||
@property (nullable, nonatomic) Class formSegueClass;
|
||||
@property (nullable, nonatomic, strong) NSString * formSegueIdenfifier DEPRECATED_ATTRIBUTE DEPRECATED_MSG_ATTRIBUTE("Use formSegueIdentifier instead");
|
||||
@property (nullable, nonatomic, strong) NSString * formSegueIdentifier;
|
||||
@property (nullable, nonatomic, strong) Class formSegueClass;
|
||||
|
||||
@end
|
||||
|
||||
@@ -33,7 +33,7 @@ CGFloat XLFormRowInitialHeight = -2;
|
||||
|
||||
@interface XLFormDescriptor (_XLFormRowDescriptor)
|
||||
|
||||
@property (nonatomic, readonly, strong) NSDictionary *allRowsByTag;
|
||||
@property (readonly) NSDictionary* allRowsByTag;
|
||||
|
||||
-(void)addObserversOfObject:(id)sectionOrRow predicateType:(XLPredicateType)predicateType;
|
||||
-(void)removeObserversOfObject:(id)sectionOrRow predicateType:(XLPredicateType)predicateType;
|
||||
@@ -42,26 +42,22 @@ CGFloat XLFormRowInitialHeight = -2;
|
||||
|
||||
@interface XLFormSectionDescriptor (_XLFormRowDescriptor)
|
||||
|
||||
-(void)showFormRow:(XLFormRowDescriptor *)formRow;
|
||||
-(void)hideFormRow:(XLFormRowDescriptor *)formRow;
|
||||
-(void)showFormRow:(XLFormRowDescriptor*)formRow;
|
||||
-(void)hideFormRow:(XLFormRowDescriptor*)formRow;
|
||||
|
||||
@end
|
||||
|
||||
#import "NSObject+XLFormAdditions.h"
|
||||
|
||||
NSString * const XLValueKey = @"value";
|
||||
NSString * const XLDisablePredicateCacheKey = @"disablePredicateCache";
|
||||
NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
|
||||
@interface XLFormRowDescriptor() <NSCopying>
|
||||
|
||||
@property (nonatomic, strong) XLFormBaseCell *cell;
|
||||
@property (nonatomic, strong) NSMutableArray *validators;
|
||||
@property XLFormBaseCell * cell;
|
||||
@property (nonatomic) NSMutableArray *validators;
|
||||
|
||||
@property (nonatomic, assign) BOOL isDirtyDisablePredicateCache;
|
||||
@property (nonatomic, copy ) NSNumber *disablePredicateCache;
|
||||
@property (nonatomic, assign) BOOL isDirtyHidePredicateCache;
|
||||
@property (nonatomic, copy ) NSNumber *hidePredicateCache;
|
||||
@property BOOL isDirtyDisablePredicateCache;
|
||||
@property (nonatomic) NSNumber* disablePredicateCache;
|
||||
@property BOOL isDirtyHidePredicateCache;
|
||||
@property (nonatomic) NSNumber* hidePredicateCache;
|
||||
|
||||
@end
|
||||
|
||||
@@ -85,7 +81,8 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
|
||||
-(instancetype)initWithTag:(NSString *)tag rowType:(NSString *)rowType title:(NSString *)title;
|
||||
{
|
||||
if (self = [super init]) {
|
||||
self = [super init];
|
||||
if (self){
|
||||
NSAssert(((![rowType isEqualToString:XLFormRowDescriptorTypeSelectorPopover] && ![rowType isEqualToString:XLFormRowDescriptorTypeMultipleSelectorPopover]) || (([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) && ([rowType isEqualToString:XLFormRowDescriptorTypeSelectorPopover] || [rowType isEqualToString:XLFormRowDescriptorTypeMultipleSelectorPopover]))), @"You must be running under UIUserInterfaceIdiomPad to use either XLFormRowDescriptorTypeSelectorPopover or XLFormRowDescriptorTypeMultipleSelectorPopover rows.");
|
||||
_tag = tag;
|
||||
_disabled = @NO;
|
||||
@@ -102,19 +99,11 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
_isDirtyHidePredicateCache = YES;
|
||||
_hidePredicateCache = nil;
|
||||
_height = XLFormRowInitialHeight;
|
||||
|
||||
[self addObserver:self
|
||||
forKeyPath:XLValueKey
|
||||
options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:0];
|
||||
[self addObserver:self
|
||||
forKeyPath:XLDisablePredicateCacheKey
|
||||
options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:0];
|
||||
[self addObserver:self
|
||||
forKeyPath:XLHidePredicateCacheKey
|
||||
options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:0];
|
||||
[self addObserver:self forKeyPath:@"value" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:0];
|
||||
[self addObserver:self forKeyPath:@"disablePredicateCache" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:0];
|
||||
[self addObserver:self forKeyPath:@"hidePredicateCache" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:0];
|
||||
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -130,16 +119,13 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
|
||||
-(XLFormBaseCell *)cellForFormController:(XLFormViewController * __unused)formController
|
||||
{
|
||||
if (!_cell) {
|
||||
if (!_cell){
|
||||
id cellClass = self.cellClass ?: [XLFormViewController cellClassesForRowDescriptorTypes][self.rowType];
|
||||
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
NSString *cellClassString = cellClass;
|
||||
NSString *cellResource = nil;
|
||||
|
||||
NSAssert(cellClass, @"Not defined XLFormRowDescriptorType: %@", self.rowType ?: @"");
|
||||
|
||||
if ([cellClass isKindOfClass:[NSString class]]) {
|
||||
NSString *cellClassString = cellClass;
|
||||
NSString *cellResource = nil;
|
||||
NSBundle *bundle = nil;
|
||||
if ([cellClassString rangeOfString:@"/"].location != NSNotFound) {
|
||||
NSArray *components = [cellClassString componentsSeparatedByString:@"/"];
|
||||
cellResource = [components lastObject];
|
||||
@@ -147,109 +133,94 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
NSString *bundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:folderName];
|
||||
bundle = [NSBundle bundleWithPath:bundlePath];
|
||||
} else {
|
||||
cellResource = [cellClassString componentsSeparatedByString:@"."].lastObject;
|
||||
bundle = [NSBundle bundleForClass:NSClassFromString(cellClass)];
|
||||
cellResource = cellClassString;
|
||||
}
|
||||
NSParameterAssert(bundle != nil);
|
||||
NSParameterAssert(cellResource != nil);
|
||||
|
||||
if ([bundle pathForResource:cellResource ofType:@"nib"]){
|
||||
_cell = [[bundle loadNibNamed:cellResource owner:nil options:nil] firstObject];
|
||||
}
|
||||
} else {
|
||||
cellResource = [NSStringFromClass(cellClass) componentsSeparatedByString:@"."].lastObject;
|
||||
}
|
||||
|
||||
if ([bundle pathForResource:cellResource ofType:@"nib"]) {
|
||||
_cell = [[bundle loadNibNamed:cellResource owner:nil options:nil] firstObject];
|
||||
} else {
|
||||
_cell = [[cellClass alloc] initWithStyle:self.cellStyle reuseIdentifier:nil];
|
||||
}
|
||||
|
||||
_cell.rowDescriptor = self;
|
||||
|
||||
NSAssert([_cell isKindOfClass:[XLFormBaseCell class]], @"UITableViewCell must extend from XLFormBaseCell");
|
||||
|
||||
[self configureCellAtCreationTime];
|
||||
}
|
||||
|
||||
return _cell;
|
||||
}
|
||||
|
||||
- (void)configureCellAtCreationTime
|
||||
{
|
||||
[self.cellConfigAtConfigure enumerateKeysAndObjectsUsingBlock:^(NSString *keyPath, id value, __unused BOOL *stop) {
|
||||
[self.cell setValue:(value == [NSNull null]) ? nil : value forKeyPath:keyPath];
|
||||
[_cell setValue:(value == [NSNull null]) ? nil : value forKeyPath:keyPath];
|
||||
}];
|
||||
}
|
||||
|
||||
-(NSMutableDictionary *)cellConfig
|
||||
{
|
||||
if (!_cellConfig) {
|
||||
_cellConfig = [NSMutableDictionary dictionary];
|
||||
}
|
||||
|
||||
if (_cellConfig) return _cellConfig;
|
||||
_cellConfig = [NSMutableDictionary dictionary];
|
||||
return _cellConfig;
|
||||
}
|
||||
|
||||
-(NSMutableDictionary *)cellConfigForSelector
|
||||
{
|
||||
if (!_cellConfigForSelector) {
|
||||
_cellConfigForSelector = [NSMutableDictionary dictionary];
|
||||
}
|
||||
|
||||
if (_cellConfigForSelector) return _cellConfigForSelector;
|
||||
_cellConfigForSelector = [NSMutableDictionary dictionary];
|
||||
return _cellConfigForSelector;
|
||||
}
|
||||
|
||||
|
||||
-(NSMutableDictionary *)cellConfigIfDisabled
|
||||
{
|
||||
if (!_cellConfigIfDisabled) {
|
||||
_cellConfigIfDisabled = [NSMutableDictionary dictionary];
|
||||
}
|
||||
|
||||
if (_cellConfigIfDisabled) return _cellConfigIfDisabled;
|
||||
_cellConfigIfDisabled = [NSMutableDictionary dictionary];
|
||||
return _cellConfigIfDisabled;
|
||||
}
|
||||
|
||||
-(NSMutableDictionary *)cellConfigAtConfigure
|
||||
{
|
||||
if (!_cellConfigAtConfigure) {
|
||||
_cellConfigAtConfigure = [NSMutableDictionary dictionary];
|
||||
}
|
||||
|
||||
if (_cellConfigAtConfigure) return _cellConfigAtConfigure;
|
||||
_cellConfigAtConfigure = [NSMutableDictionary dictionary];
|
||||
return _cellConfigAtConfigure;
|
||||
}
|
||||
|
||||
-(NSString *)editTextValue
|
||||
-(NSString*)editTextValue
|
||||
{
|
||||
NSString *result = @"";
|
||||
|
||||
if (self.value) {
|
||||
if (self.valueFormatter) {
|
||||
if (self.useValueFormatterDuringInput) {
|
||||
result = [self displayTextValue];
|
||||
}
|
||||
else {
|
||||
return [self displayTextValue];
|
||||
}else{
|
||||
// have formatter, but we don't want to use it during editing
|
||||
result = [self.value displayText];
|
||||
return [self.value displayText];
|
||||
}
|
||||
}
|
||||
else {
|
||||
}else{
|
||||
// have value, but no formatter, use the value's displayText
|
||||
result = [self.value displayText];
|
||||
return [self.value displayText];
|
||||
}
|
||||
}else{
|
||||
// placeholder
|
||||
return @"";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
-(NSString *)displayTextValue
|
||||
-(NSString*)displayTextValue
|
||||
{
|
||||
NSString *result = self.noValueDisplayText;
|
||||
|
||||
if (self.value) {
|
||||
if (self.valueFormatter) {
|
||||
result = [self.valueFormatter stringForObjectValue:self.value];
|
||||
return [self.valueFormatter stringForObjectValue:self.value];
|
||||
}
|
||||
else {
|
||||
result = [self.value displayText];
|
||||
else{
|
||||
return [self.value displayText];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
else {
|
||||
return self.noValueDisplayText;
|
||||
}
|
||||
}
|
||||
|
||||
-(NSString *)description
|
||||
@@ -259,10 +230,9 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
|
||||
-(XLFormAction *)action
|
||||
{
|
||||
if (!_action) {
|
||||
if (!_action){
|
||||
_action = [[XLFormAction alloc] init];
|
||||
}
|
||||
|
||||
return _action;
|
||||
}
|
||||
|
||||
@@ -273,15 +243,13 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
|
||||
-(CGFloat)height
|
||||
{
|
||||
if (_height == XLFormRowInitialHeight) {
|
||||
if (_height == XLFormRowInitialHeight){
|
||||
if ([[self.cell class] respondsToSelector:@selector(formDescriptorCellHeightForRowDescriptor:)]){
|
||||
return [[self.cell class] formDescriptorCellHeightForRowDescriptor:self];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
_height = XLFormUnspecifiedCellHeight;
|
||||
}
|
||||
}
|
||||
|
||||
return _height;
|
||||
}
|
||||
|
||||
@@ -292,76 +260,71 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
// In the implementation
|
||||
-(id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
XLFormRowDescriptor *rowDescriptorCopy = [XLFormRowDescriptor formRowDescriptorWithTag:nil
|
||||
rowType:[self.rowType copy]
|
||||
title:[self.title copy]];
|
||||
XLFormRowDescriptor * rowDescriptorCopy = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:[self.rowType copy] title:[self.title copy]];
|
||||
rowDescriptorCopy.cellClass = [self.cellClass copy];
|
||||
[rowDescriptorCopy.cellConfig addEntriesFromDictionary:self.cellConfig];
|
||||
[rowDescriptorCopy.cellConfigAtConfigure addEntriesFromDictionary:self.cellConfigAtConfigure];
|
||||
rowDescriptorCopy.valueTransformer = [self.valueTransformer copy];
|
||||
rowDescriptorCopy.hidden = self.hidden;
|
||||
rowDescriptorCopy.disabled = self.disabled;
|
||||
rowDescriptorCopy->_hidden = _hidden;
|
||||
rowDescriptorCopy->_disabled = _disabled;
|
||||
rowDescriptorCopy.required = self.isRequired;
|
||||
rowDescriptorCopy.isDirtyDisablePredicateCache = YES;
|
||||
rowDescriptorCopy.isDirtyHidePredicateCache = YES;
|
||||
rowDescriptorCopy.validators = [self.validators mutableCopy];
|
||||
|
||||
|
||||
// =====================
|
||||
// properties for Button
|
||||
// =====================
|
||||
rowDescriptorCopy.action = [self.action copy];
|
||||
|
||||
|
||||
|
||||
|
||||
// ===========================
|
||||
// property used for Selectors
|
||||
// ===========================
|
||||
|
||||
|
||||
rowDescriptorCopy.noValueDisplayText = [self.noValueDisplayText copy];
|
||||
rowDescriptorCopy.selectorTitle = [self.selectorTitle copy];
|
||||
rowDescriptorCopy.selectorOptions = [self.selectorOptions copy];
|
||||
rowDescriptorCopy.leftRightSelectorLeftOptionSelected = [self.leftRightSelectorLeftOptionSelected copy];
|
||||
|
||||
|
||||
return rowDescriptorCopy;
|
||||
}
|
||||
|
||||
-(void)dealloc
|
||||
{
|
||||
[self removeObserver:self forKeyPath:XLValueKey];
|
||||
[self removeObserver:self forKeyPath:XLDisablePredicateCacheKey];
|
||||
[self removeObserver:self forKeyPath:XLHidePredicateCacheKey];
|
||||
|
||||
[self.sectionDescriptor.formDescriptor removeObserversOfObject:self predicateType:XLPredicateTypeDisabled];
|
||||
[self.sectionDescriptor.formDescriptor removeObserversOfObject:self predicateType:XLPredicateTypeHidden];
|
||||
|
||||
_cell = nil;
|
||||
|
||||
[self.validators removeAllObjects];
|
||||
self.validators = nil;
|
||||
@try {
|
||||
[self removeObserver:self forKeyPath:@"value"];
|
||||
}
|
||||
@catch (NSException * __unused exception) {}
|
||||
@try {
|
||||
[self removeObserver:self forKeyPath:@"disablePredicateCache"];
|
||||
}
|
||||
@catch (NSException * __unused exception) {}
|
||||
@try {
|
||||
[self removeObserver:self forKeyPath:@"hidePredicateCache"];
|
||||
}
|
||||
@catch (NSException * __unused exception) {}
|
||||
}
|
||||
|
||||
#pragma mark - KVO
|
||||
|
||||
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
||||
{
|
||||
if (!self.sectionDescriptor) {
|
||||
return;
|
||||
}
|
||||
else if (object == self && ([keyPath isEqualToString:XLValueKey] ||
|
||||
[keyPath isEqualToString:XLHidePredicateCacheKey] || [keyPath isEqualToString:XLDisablePredicateCacheKey])) {
|
||||
if (!self.sectionDescriptor) return;
|
||||
if (object == self && ([keyPath isEqualToString:@"value"] || [keyPath isEqualToString:@"hidePredicateCache"] || [keyPath isEqualToString:@"disablePredicateCache"])){
|
||||
if ([[change objectForKey:NSKeyValueChangeKindKey] isEqualToNumber:@(NSKeyValueChangeSetting)]){
|
||||
id newValue = [change objectForKey:NSKeyValueChangeNewKey];
|
||||
id oldValue = [change objectForKey:NSKeyValueChangeOldKey];
|
||||
if ([keyPath isEqualToString:XLValueKey]) {
|
||||
if ([keyPath isEqualToString:@"value"]){
|
||||
[self.sectionDescriptor.formDescriptor.delegate formRowDescriptorValueHasChanged:object oldValue:oldValue newValue:newValue];
|
||||
if (self.onChangeBlock) {
|
||||
self.onChangeBlock(oldValue, newValue, self);
|
||||
}
|
||||
}
|
||||
else {
|
||||
[self.sectionDescriptor.formDescriptor.delegate formRowDescriptorPredicateHasChanged:object
|
||||
oldValue:oldValue
|
||||
newValue:newValue
|
||||
predicateType:([keyPath isEqualToString:XLHidePredicateCacheKey] ? XLPredicateTypeHidden : XLPredicateTypeDisabled)];
|
||||
else{
|
||||
[self.sectionDescriptor.formDescriptor.delegate formRowDescriptorPredicateHasChanged:object oldValue:oldValue newValue:newValue predicateType:([keyPath isEqualToString:@"hidePredicateCache"] ? XLPredicateTypeHidden : XLPredicateTypeDisabled)];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -371,14 +334,12 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
|
||||
-(BOOL)isDisabled
|
||||
{
|
||||
if (self.sectionDescriptor.formDescriptor.isDisabled) {
|
||||
if (self.sectionDescriptor.formDescriptor.isDisabled){
|
||||
return YES;
|
||||
}
|
||||
|
||||
if (self.isDirtyDisablePredicateCache) {
|
||||
[self evaluateIsDisabled];
|
||||
}
|
||||
|
||||
return [self.disablePredicateCache boolValue];
|
||||
}
|
||||
|
||||
@@ -387,12 +348,11 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
if ([_disabled isKindOfClass:[NSPredicate class]]){
|
||||
[self.sectionDescriptor.formDescriptor removeObserversOfObject:self predicateType:XLPredicateTypeDisabled];
|
||||
}
|
||||
|
||||
_disabled = [disabled isKindOfClass:[NSString class]] ? [disabled formPredicate] : disabled;
|
||||
if ([_disabled isKindOfClass:[NSPredicate class]]){
|
||||
[self.sectionDescriptor.formDescriptor addObserversOfObject:self predicateType:XLPredicateTypeDisabled];
|
||||
}
|
||||
|
||||
|
||||
[self evaluateIsDisabled];
|
||||
}
|
||||
|
||||
@@ -401,8 +361,7 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
if ([_disabled isKindOfClass:[NSPredicate class]]) {
|
||||
if (!self.sectionDescriptor.formDescriptor) {
|
||||
self.isDirtyDisablePredicateCache = YES;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
@try {
|
||||
self.disablePredicateCache = @([_disabled evaluateWithObject:self substitutionVariables:self.sectionDescriptor.formDescriptor.allRowsByTag ?: @{}]);
|
||||
}
|
||||
@@ -412,14 +371,12 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
};
|
||||
}
|
||||
}
|
||||
else {
|
||||
else{
|
||||
self.disablePredicateCache = _disabled;
|
||||
}
|
||||
|
||||
if ([self.disablePredicateCache boolValue]) {
|
||||
if ([self.disablePredicateCache boolValue]){
|
||||
[self.cell resignFirstResponder];
|
||||
}
|
||||
|
||||
return [self.disablePredicateCache boolValue];
|
||||
}
|
||||
|
||||
@@ -430,9 +387,9 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
|
||||
-(void)setDisablePredicateCache:(NSNumber*)disablePredicateCache
|
||||
{
|
||||
NSParameterAssert(disablePredicateCache != nil);
|
||||
NSParameterAssert(disablePredicateCache);
|
||||
self.isDirtyDisablePredicateCache = NO;
|
||||
if (_disablePredicateCache == nil || ![_disablePredicateCache isEqualToNumber:disablePredicateCache]){
|
||||
if (!_disablePredicateCache || ![_disablePredicateCache isEqualToNumber:disablePredicateCache]){
|
||||
_disablePredicateCache = disablePredicateCache;
|
||||
}
|
||||
}
|
||||
@@ -451,9 +408,9 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
|
||||
-(void)setHidePredicateCache:(NSNumber *)hidePredicateCache
|
||||
{
|
||||
NSParameterAssert(hidePredicateCache != nil);
|
||||
NSParameterAssert(hidePredicateCache);
|
||||
self.isDirtyHidePredicateCache = NO;
|
||||
if (_hidePredicateCache == nil || ![_hidePredicateCache isEqualToNumber:hidePredicateCache]){
|
||||
if (!_hidePredicateCache || ![_hidePredicateCache isEqualToNumber:hidePredicateCache]){
|
||||
_hidePredicateCache = hidePredicateCache;
|
||||
}
|
||||
}
|
||||
@@ -463,7 +420,6 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
if (self.isDirtyHidePredicateCache) {
|
||||
return [self evaluateIsHidden];
|
||||
}
|
||||
|
||||
return [self.hidePredicateCache boolValue];
|
||||
}
|
||||
|
||||
@@ -472,8 +428,7 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
if ([_hidden isKindOfClass:[NSPredicate class]]) {
|
||||
if (!self.sectionDescriptor.formDescriptor) {
|
||||
self.isDirtyHidePredicateCache = YES;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
@try {
|
||||
self.hidePredicateCache = @([_hidden evaluateWithObject:self substitutionVariables:self.sectionDescriptor.formDescriptor.allRowsByTag ?: @{}]);
|
||||
}
|
||||
@@ -483,18 +438,16 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
};
|
||||
}
|
||||
}
|
||||
else {
|
||||
else{
|
||||
self.hidePredicateCache = _hidden;
|
||||
}
|
||||
|
||||
if ([self.hidePredicateCache boolValue]){
|
||||
[self.cell resignFirstResponder];
|
||||
[self.sectionDescriptor hideFormRow:self];
|
||||
}
|
||||
else {
|
||||
else{
|
||||
[self.sectionDescriptor showFormRow:self];
|
||||
}
|
||||
|
||||
return [self.hidePredicateCache boolValue];
|
||||
}
|
||||
|
||||
@@ -504,12 +457,10 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
if ([_hidden isKindOfClass:[NSPredicate class]]){
|
||||
[self.sectionDescriptor.formDescriptor removeObserversOfObject:self predicateType:XLPredicateTypeHidden];
|
||||
}
|
||||
|
||||
_hidden = [hidden isKindOfClass:[NSString class]] ? [hidden formPredicate] : hidden;
|
||||
if ([_hidden isKindOfClass:[NSPredicate class]]){
|
||||
[self.sectionDescriptor.formDescriptor addObserversOfObject:self predicateType:XLPredicateTypeHidden];
|
||||
}
|
||||
|
||||
[self evaluateIsHidden]; // check and update if this row should be hidden.
|
||||
}
|
||||
|
||||
@@ -523,35 +474,34 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
|
||||
-(void)addValidator:(id<XLFormValidatorProtocol>)validator
|
||||
{
|
||||
if (validator == nil || ![validator conformsToProtocol:@protocol(XLFormValidatorProtocol)]) {
|
||||
if (validator == nil || ![validator conformsToProtocol:@protocol(XLFormValidatorProtocol)])
|
||||
return;
|
||||
}
|
||||
else if (![self.validators containsObject:validator]) {
|
||||
|
||||
if(![self.validators containsObject:validator]) {
|
||||
[self.validators addObject:validator];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)removeValidator:(id<XLFormValidatorProtocol>)validator
|
||||
{
|
||||
if (validator == nil || ![validator conformsToProtocol:@protocol(XLFormValidatorProtocol)]) {
|
||||
if (validator == nil|| ![validator conformsToProtocol:@protocol(XLFormValidatorProtocol)])
|
||||
return;
|
||||
}
|
||||
else if ([self.validators containsObject:validator]) {
|
||||
|
||||
if ([self.validators containsObject:validator]) {
|
||||
[self.validators removeObject:validator];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)valueIsEmpty
|
||||
{
|
||||
return self.value == nil || [self.value isKindOfClass:[NSNull class]] ||
|
||||
([self.value respondsToSelector:@selector(length)] && [self.value length] == 0) ||
|
||||
([self.value respondsToSelector:@selector(count)] && [self.value count] == 0);
|
||||
return self.value == nil || [self.value isKindOfClass:[NSNull class]] || ([self.value respondsToSelector:@selector(length)] && [self.value length]==0) ||
|
||||
([self.value respondsToSelector:@selector(count)] && [self.value count]==0);
|
||||
}
|
||||
|
||||
-(XLFormValidationStatus *)doValidation
|
||||
{
|
||||
XLFormValidationStatus *valStatus = nil;
|
||||
|
||||
|
||||
if (self.required) {
|
||||
// do required validation here
|
||||
if ([self valueIsEmpty]) {
|
||||
@@ -559,24 +509,22 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
NSString *msg = nil;
|
||||
if (self.requireMsg != nil) {
|
||||
msg = self.requireMsg;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// default message for required msg
|
||||
msg = NSLocalizedString(@"%@ can't be empty", nil);
|
||||
}
|
||||
|
||||
if (self.title.length) {
|
||||
|
||||
if (self.title != nil) {
|
||||
valStatus.msg = [NSString stringWithFormat:msg, self.title];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
valStatus.msg = [NSString stringWithFormat:msg, self.tag];
|
||||
}
|
||||
|
||||
|
||||
return valStatus;
|
||||
}
|
||||
}
|
||||
// custom validator
|
||||
for (id<XLFormValidatorProtocol> v in self.validators) {
|
||||
for(id<XLFormValidatorProtocol> v in self.validators) {
|
||||
if ([v conformsToProtocol:@protocol(XLFormValidatorProtocol)]) {
|
||||
XLFormValidationStatus *vStatus = [v isValid:self];
|
||||
// fail validation
|
||||
@@ -584,12 +532,10 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
return vStatus;
|
||||
}
|
||||
valStatus = vStatus;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
valStatus = nil;
|
||||
}
|
||||
}
|
||||
|
||||
return valStatus;
|
||||
}
|
||||
|
||||
@@ -645,13 +591,13 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
|
||||
-(instancetype)initWithLeftValue:(NSString *)leftValue httpParameterKey:(NSString *)httpParameterKey rightOptions:(NSArray *)rightOptions
|
||||
{
|
||||
if (self = [super init]) {
|
||||
self = [super init];
|
||||
if (self){
|
||||
_selectorTitle = nil;
|
||||
_leftValue = leftValue;
|
||||
_rightOptions = rightOptions;
|
||||
_httpParameterKey = httpParameterKey;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -662,10 +608,10 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if (self = [super init]) {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_viewControllerPresentationMode = XLFormPresentationModeDefault;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -677,25 +623,24 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
if (self.viewControllerClass){
|
||||
actionCopy.viewControllerClass = [self.viewControllerClass copy];
|
||||
}
|
||||
else if ([self.viewControllerStoryboardId length] != 0) {
|
||||
else if ([self.viewControllerStoryboardId length] != 0){
|
||||
actionCopy.viewControllerStoryboardId = [self.viewControllerStoryboardId copy];
|
||||
}
|
||||
else if ([self.viewControllerNibName length] != 0) {
|
||||
else if ([self.viewControllerNibName length] != 0){
|
||||
actionCopy.viewControllerNibName = [self.viewControllerNibName copy];
|
||||
}
|
||||
if (self.formBlock) {
|
||||
if (self.formBlock){
|
||||
actionCopy.formBlock = [self.formBlock copy];
|
||||
}
|
||||
else if (self.formSelector) {
|
||||
else if (self.formSelector){
|
||||
actionCopy.formSelector = self.formSelector;
|
||||
}
|
||||
else if (self.formSegueIdentifier) {
|
||||
else if (self.formSegueIdentifier){
|
||||
actionCopy.formSegueIdentifier = [self.formSegueIdentifier copy];
|
||||
}
|
||||
else if (self.formSegueClass){
|
||||
actionCopy.formSegueClass = [self.formSegueClass copy];
|
||||
}
|
||||
|
||||
return actionCopy;
|
||||
}
|
||||
|
||||
@@ -720,6 +665,7 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
_viewControllerStoryboardId = viewControllerStoryboardId;
|
||||
}
|
||||
|
||||
|
||||
-(void)setFormSelector:(SEL)formSelector
|
||||
{
|
||||
_formBlock = nil;
|
||||
@@ -728,6 +674,7 @@ NSString * const XLHidePredicateCacheKey = @"hidePredicateCache";
|
||||
_formSelector = formSelector;
|
||||
}
|
||||
|
||||
|
||||
-(void)setFormBlock:(void (^)(XLFormRowDescriptor *))formBlock
|
||||
{
|
||||
_formSegueClass = nil;
|
||||
|
||||
@@ -42,19 +42,19 @@ typedef NS_ENUM(NSUInteger, XLFormSectionInsertMode) {
|
||||
|
||||
@interface XLFormSectionDescriptor : NSObject
|
||||
|
||||
@property (nonatomic, nullable, copy) NSString * title;
|
||||
@property (nonatomic, nullable, copy) NSString * footerTitle;
|
||||
@property (nonatomic, readonly, nonnull, strong) NSMutableArray * formRows;
|
||||
@property (nonatomic, nullable) NSString * title;
|
||||
@property (nonatomic, nullable) NSString * footerTitle;
|
||||
@property (readonly, nonnull) NSMutableArray * formRows;
|
||||
|
||||
@property (nonatomic, readonly, assign) XLFormSectionInsertMode sectionInsertMode;
|
||||
@property (nonatomic, readonly, assign) XLFormSectionOptions sectionOptions;
|
||||
@property (nonatomic, nullable, strong) XLFormRowDescriptor * multivaluedRowTemplate;
|
||||
@property (nonatomic, readonly, nullable, strong) XLFormRowDescriptor * multivaluedAddButton;
|
||||
@property (nonatomic, nullable, copy) NSString * multivaluedTag;
|
||||
@property (readonly) XLFormSectionInsertMode sectionInsertMode;
|
||||
@property (readonly) XLFormSectionOptions sectionOptions;
|
||||
@property (nullable) XLFormRowDescriptor * multivaluedRowTemplate;
|
||||
@property (readonly, nullable) XLFormRowDescriptor * multivaluedAddButton;
|
||||
@property (nonatomic, nullable) NSString * multivaluedTag;
|
||||
|
||||
@property (nonatomic, weak, null_unspecified) XLFormDescriptor * formDescriptor;
|
||||
@property (weak, null_unspecified) XLFormDescriptor * formDescriptor;
|
||||
|
||||
@property (nonatomic, nonnull, strong) id hidden;
|
||||
@property (nonnull) id hidden;
|
||||
-(BOOL)isHidden;
|
||||
|
||||
+(nonnull instancetype)formSection;
|
||||
|
||||
@@ -29,16 +29,15 @@
|
||||
#import "NSString+XLFormAdditions.h"
|
||||
#import "UIView+XLFormAdditions.h"
|
||||
|
||||
NSString * const XLFormRowsKey = @"formRows";
|
||||
|
||||
@interface XLFormDescriptor (_XLFormSectionDescriptor)
|
||||
|
||||
@property (nonatomic, weak, readonly) NSDictionary *allRowsByTag;
|
||||
@property (readonly) NSDictionary* allRowsByTag;
|
||||
|
||||
-(void)addRowToTagCollection:(XLFormRowDescriptor *)rowDescriptor;
|
||||
-(void)removeRowFromTagCollection:(XLFormRowDescriptor *) rowDescriptor;
|
||||
-(void)showFormSection:(XLFormSectionDescriptor *)formSection;
|
||||
-(void)hideFormSection:(XLFormSectionDescriptor *)formSection;
|
||||
-(void)addRowToTagCollection:(XLFormRowDescriptor*)rowDescriptor;
|
||||
-(void)removeRowFromTagCollection:(XLFormRowDescriptor*) rowDescriptor;
|
||||
-(void)showFormSection:(XLFormSectionDescriptor*)formSection;
|
||||
-(void)hideFormSection:(XLFormSectionDescriptor*)formSection;
|
||||
|
||||
-(void)addObserversOfObject:(id)sectionOrRow predicateType:(XLPredicateType)predicateType;
|
||||
-(void)removeObserversOfObject:(id)sectionOrRow predicateType:(XLPredicateType)predicateType;
|
||||
@@ -47,11 +46,10 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
|
||||
@interface XLFormSectionDescriptor()
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray *formRows;
|
||||
@property (nonatomic, strong) NSMutableArray *allRows;
|
||||
|
||||
@property (nonatomic, assign) BOOL isDirtyHidePredicateCache;
|
||||
@property (nonatomic, copy ) NSNumber *hidePredicateCache;
|
||||
@property NSMutableArray * formRows;
|
||||
@property NSMutableArray * allRows;
|
||||
@property BOOL isDirtyHidePredicateCache;
|
||||
@property (nonatomic) NSNumber* hidePredicateCache;
|
||||
|
||||
@end
|
||||
|
||||
@@ -62,7 +60,8 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
|
||||
-(instancetype)init
|
||||
{
|
||||
if (self = [super init]) {
|
||||
self = [super init];
|
||||
if (self){
|
||||
_formRows = [NSMutableArray array];
|
||||
_allRows = [NSMutableArray array];
|
||||
_sectionInsertMode = XLFormSectionInsertModeLastRow;
|
||||
@@ -72,35 +71,25 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
_hidden = @NO;
|
||||
_hidePredicateCache = @NO;
|
||||
_isDirtyHidePredicateCache = YES;
|
||||
|
||||
[self addObserver:self
|
||||
forKeyPath:XLFormRowsKey
|
||||
options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:0];
|
||||
[self addObserver:self forKeyPath:@"formRows" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:0];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(instancetype)initWithTitle:(NSString *)title sectionOptions:(XLFormSectionOptions)sectionOptions sectionInsertMode:(XLFormSectionInsertMode)sectionInsertMode
|
||||
{
|
||||
if (self = [self init]) {
|
||||
-(instancetype)initWithTitle:(NSString *)title sectionOptions:(XLFormSectionOptions)sectionOptions sectionInsertMode:(XLFormSectionInsertMode)sectionInsertMode{
|
||||
self = [self init];
|
||||
if (self){
|
||||
_sectionInsertMode = sectionInsertMode;
|
||||
_sectionOptions = sectionOptions;
|
||||
_title = title;
|
||||
|
||||
if ([self canInsertUsingButton]) {
|
||||
_multivaluedAddButton = [XLFormRowDescriptor formRowDescriptorWithTag:nil
|
||||
rowType:XLFormRowDescriptorTypeButton
|
||||
title:@"Add Item"];
|
||||
|
||||
if ([self canInsertUsingButton]){
|
||||
_multivaluedAddButton = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeButton title:@"Add Item"];
|
||||
[_multivaluedAddButton.cellConfig setObject:@(NSTextAlignmentNatural) forKey:@"textLabel.textAlignment"];
|
||||
_multivaluedAddButton.action.formSelector = NSSelectorFromString(@"multivaluedInsertButtonTapped:");
|
||||
|
||||
[self insertObject:_multivaluedAddButton inFormRowsAtIndex:0];
|
||||
[self insertObject:_multivaluedAddButton inAllRowsAtIndex:0];
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -136,13 +125,7 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
|
||||
-(void)addFormRow:(XLFormRowDescriptor *)formRow
|
||||
{
|
||||
NSUInteger index = [self.allRows count];
|
||||
|
||||
if ([self canInsertUsingButton]) {
|
||||
index = ([self.formRows count] > 0) ? [self.formRows count] - 1 : 0;
|
||||
}
|
||||
|
||||
[self insertObject:formRow inAllRowsAtIndex:index];
|
||||
[self insertObject:formRow inAllRowsAtIndex:([self canInsertUsingButton] ? MAX(0, [self.formRows count] - 1) : [self.allRows count])];
|
||||
}
|
||||
|
||||
-(void)addFormRow:(XLFormRowDescriptor *)formRow afterRow:(XLFormRowDescriptor *)afterRow
|
||||
@@ -153,23 +136,26 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
}
|
||||
else { //case when afterRow does not exist. Just insert at the end.
|
||||
[self addFormRow:formRow];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)addFormRow:(XLFormRowDescriptor *)formRow beforeRow:(XLFormRowDescriptor *)beforeRow
|
||||
{
|
||||
|
||||
NSUInteger allRowIndex = [self.allRows indexOfObject:beforeRow];
|
||||
if (allRowIndex != NSNotFound) {
|
||||
[self insertObject:formRow inAllRowsAtIndex:allRowIndex];
|
||||
}
|
||||
else { //case when afterRow does not exist. Just insert at the end.
|
||||
[self addFormRow:formRow];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)removeFormRowAtIndex:(NSUInteger)index
|
||||
{
|
||||
if (self.formRows.count > index) {
|
||||
if (self.formRows.count > index){
|
||||
XLFormRowDescriptor *formRow = [self.formRows objectAtIndex:index];
|
||||
NSUInteger allRowIndex = [self.allRows indexOfObject:formRow];
|
||||
[self removeObjectFromFormRowsAtIndex:index];
|
||||
@@ -180,21 +166,21 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
-(void)removeFormRow:(XLFormRowDescriptor *)formRow
|
||||
{
|
||||
NSUInteger index = NSNotFound;
|
||||
if ((index = [self.formRows indexOfObject:formRow]) != NSNotFound) {
|
||||
if ((index = [self.formRows indexOfObject:formRow]) != NSNotFound){
|
||||
[self removeFormRowAtIndex:index];
|
||||
}
|
||||
else if ((index = [self.allRows indexOfObject:formRow]) != NSNotFound) {
|
||||
if (self.allRows.count > index) {
|
||||
else if ((index = [self.allRows indexOfObject:formRow]) != NSNotFound){
|
||||
if (self.allRows.count > index){
|
||||
[self removeObjectFromAllRowsAtIndex:index];
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
- (void)moveRowAtIndexPath:(NSIndexPath *)sourceIndex toIndexPath:(NSIndexPath *)destinationIndex
|
||||
{
|
||||
if ((sourceIndex.row < self.formRows.count) && (destinationIndex.row < self.formRows.count) && (sourceIndex.row != destinationIndex.row)) {
|
||||
XLFormRowDescriptor *row = [self objectInFormRowsAtIndex:sourceIndex.row];
|
||||
XLFormRowDescriptor *destRow = [self objectInFormRowsAtIndex:destinationIndex.row];
|
||||
if ((sourceIndex.row < self.formRows.count) && (destinationIndex.row < self.formRows.count) && (sourceIndex.row != destinationIndex.row)){
|
||||
XLFormRowDescriptor * row = [self objectInFormRowsAtIndex:sourceIndex.row];
|
||||
XLFormRowDescriptor * destRow = [self objectInFormRowsAtIndex:destinationIndex.row];
|
||||
[self.formRows removeObjectAtIndex:sourceIndex.row];
|
||||
[self.formRows insertObject:row atIndex:destinationIndex.row];
|
||||
|
||||
@@ -205,15 +191,11 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
|
||||
-(void)dealloc
|
||||
{
|
||||
[self removeObserver:self forKeyPath:XLFormRowsKey];
|
||||
|
||||
[self.formDescriptor removeObserversOfObject:self predicateType:XLPredicateTypeHidden];
|
||||
|
||||
[self.formRows removeAllObjects];
|
||||
self.formRows = nil;
|
||||
|
||||
[self.allRows removeAllObjects];
|
||||
self.allRows = nil;
|
||||
@try {
|
||||
[self removeObserver:self forKeyPath:@"formRows"];
|
||||
}
|
||||
@catch (NSException * __unused exception) {}
|
||||
}
|
||||
|
||||
#pragma mark - Show/hide rows
|
||||
@@ -224,15 +206,13 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
if (formIndex != NSNotFound) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSUInteger index = [self.allRows indexOfObject:formRow];
|
||||
if (index != NSNotFound) {
|
||||
if (index != NSNotFound){
|
||||
while (formIndex == NSNotFound && index > 0) {
|
||||
XLFormRowDescriptor* previous = [self.allRows objectAtIndex:--index];
|
||||
formIndex = [self.formRows indexOfObject:previous];
|
||||
}
|
||||
|
||||
if (formIndex == NSNotFound) { // index == 0 => insert at the beginning
|
||||
if (formIndex == NSNotFound){ // index == 0 => insert at the beginning
|
||||
[self insertObject:formRow inFormRowsAtIndex:0];
|
||||
}
|
||||
else {
|
||||
@@ -244,41 +224,36 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
|
||||
-(void)hideFormRow:(XLFormRowDescriptor*)formRow{
|
||||
NSUInteger index = [self.formRows indexOfObject:formRow];
|
||||
if (index != NSNotFound) {
|
||||
if (index != NSNotFound){
|
||||
[self removeObjectFromFormRowsAtIndex:index];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - KVO
|
||||
|
||||
- (void)observeValueForKeyPath:(nullable NSString *)keyPath
|
||||
ofObject:(nullable id)object
|
||||
change:(nullable NSDictionary<NSKeyValueChangeKey, id> *)change
|
||||
context:(nullable void *)context
|
||||
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
||||
{
|
||||
if (!self.formDescriptor.delegate) {
|
||||
return;
|
||||
}
|
||||
else if ([keyPath isEqualToString:XLFormRowsKey]) {
|
||||
if ([self.formDescriptor.formSections containsObject:self]) {
|
||||
if ([[change objectForKey:NSKeyValueChangeKindKey] isEqualToNumber:@(NSKeyValueChangeInsertion)]) {
|
||||
NSIndexSet *indexSet = [change objectForKey:NSKeyValueChangeIndexesKey];
|
||||
XLFormRowDescriptor *formRow = [((XLFormSectionDescriptor *)object).formRows objectAtIndex:indexSet.firstIndex];
|
||||
if (!self.formDescriptor.delegate) return;
|
||||
if ([keyPath isEqualToString:@"formRows"]){
|
||||
if ([self.formDescriptor.formSections containsObject:self]){
|
||||
if ([[change objectForKey:NSKeyValueChangeKindKey] isEqualToNumber:@(NSKeyValueChangeInsertion)]){
|
||||
NSIndexSet * indexSet = [change objectForKey:NSKeyValueChangeIndexesKey];
|
||||
XLFormRowDescriptor * formRow = [((XLFormSectionDescriptor *)object).formRows objectAtIndex:indexSet.firstIndex];
|
||||
NSUInteger sectionIndex = [self.formDescriptor.formSections indexOfObject:object];
|
||||
[self.formDescriptor.delegate formRowHasBeenAdded:formRow
|
||||
atIndexPath:[NSIndexPath indexPathForRow:indexSet.firstIndex inSection:sectionIndex]];
|
||||
[self.formDescriptor.delegate formRowHasBeenAdded:formRow atIndexPath:[NSIndexPath indexPathForRow:indexSet.firstIndex inSection:sectionIndex]];
|
||||
}
|
||||
else if ([[change objectForKey:NSKeyValueChangeKindKey] isEqualToNumber:@(NSKeyValueChangeRemoval)]) {
|
||||
NSIndexSet *indexSet = [change objectForKey:NSKeyValueChangeIndexesKey];
|
||||
XLFormRowDescriptor *removedRow = [[change objectForKey:NSKeyValueChangeOldKey] objectAtIndex:0];
|
||||
else if ([[change objectForKey:NSKeyValueChangeKindKey] isEqualToNumber:@(NSKeyValueChangeRemoval)]){
|
||||
NSIndexSet * indexSet = [change objectForKey:NSKeyValueChangeIndexesKey];
|
||||
XLFormRowDescriptor * removedRow = [[change objectForKey:NSKeyValueChangeOldKey] objectAtIndex:0];
|
||||
NSUInteger sectionIndex = [self.formDescriptor.formSections indexOfObject:object];
|
||||
[self.formDescriptor.delegate formRowHasBeenRemoved:removedRow
|
||||
atIndexPath:[NSIndexPath indexPathForRow:indexSet.firstIndex inSection:sectionIndex]];
|
||||
[self.formDescriptor.delegate formRowHasBeenRemoved:removedRow atIndexPath:[NSIndexPath indexPathForRow:indexSet.firstIndex inSection:sectionIndex]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - KVC
|
||||
|
||||
-(NSUInteger)countOfFormRows
|
||||
@@ -359,9 +334,9 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
|
||||
-(void)setHidePredicateCache:(NSNumber *)hidePredicateCache
|
||||
{
|
||||
NSParameterAssert(hidePredicateCache != nil);
|
||||
NSParameterAssert(hidePredicateCache);
|
||||
self.isDirtyHidePredicateCache = NO;
|
||||
if (_hidePredicateCache == nil || ![_hidePredicateCache isEqualToNumber:hidePredicateCache]) {
|
||||
if (!_hidePredicateCache || ![_hidePredicateCache isEqualToNumber:hidePredicateCache]){
|
||||
_hidePredicateCache = hidePredicateCache;
|
||||
}
|
||||
}
|
||||
@@ -371,7 +346,6 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
if (self.isDirtyHidePredicateCache) {
|
||||
return [self evaluateIsHidden];
|
||||
}
|
||||
|
||||
return [self.hidePredicateCache boolValue];
|
||||
}
|
||||
|
||||
@@ -380,8 +354,7 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
if ([_hidden isKindOfClass:[NSPredicate class]]) {
|
||||
if (!self.formDescriptor) {
|
||||
self.isDirtyHidePredicateCache = YES;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
@try {
|
||||
self.hidePredicateCache = @([_hidden evaluateWithObject:self substitutionVariables:self.formDescriptor.allRowsByTag ?: @{}]);
|
||||
}
|
||||
@@ -391,24 +364,21 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
};
|
||||
}
|
||||
}
|
||||
else {
|
||||
else{
|
||||
self.hidePredicateCache = _hidden;
|
||||
}
|
||||
|
||||
if ([self.hidePredicateCache boolValue]) {
|
||||
if ([self.formDescriptor.delegate isKindOfClass:[XLFormViewController class]]) {
|
||||
XLFormBaseCell *firtResponder = (XLFormBaseCell *)[((XLFormViewController *)self.formDescriptor.delegate).tableView findFirstResponder];
|
||||
if ([firtResponder isKindOfClass:[XLFormBaseCell class]] && firtResponder.rowDescriptor.sectionDescriptor == self) {
|
||||
if ([self.hidePredicateCache boolValue]){
|
||||
if ([self.formDescriptor.delegate isKindOfClass:[XLFormViewController class]]){
|
||||
XLFormBaseCell* firtResponder = (XLFormBaseCell*) [((XLFormViewController*)self.formDescriptor.delegate).tableView findFirstResponder];
|
||||
if ([firtResponder isKindOfClass:[XLFormBaseCell class]] && firtResponder.rowDescriptor.sectionDescriptor == self){
|
||||
[firtResponder resignFirstResponder];
|
||||
}
|
||||
}
|
||||
|
||||
[self.formDescriptor hideFormSection:self];
|
||||
}
|
||||
else {
|
||||
else{
|
||||
[self.formDescriptor showFormSection:self];
|
||||
}
|
||||
|
||||
return [self.hidePredicateCache boolValue];
|
||||
}
|
||||
|
||||
@@ -420,15 +390,13 @@ NSString * const XLFormRowsKey = @"formRows";
|
||||
|
||||
-(void)setHidden:(id)hidden
|
||||
{
|
||||
if ([_hidden isKindOfClass:[NSPredicate class]]) {
|
||||
if ([_hidden isKindOfClass:[NSPredicate class]]){
|
||||
[self.formDescriptor removeObserversOfObject:self predicateType:XLPredicateTypeHidden];
|
||||
}
|
||||
|
||||
_hidden = [hidden isKindOfClass:[NSString class]] ? [hidden formPredicate] : hidden;
|
||||
if ([_hidden isKindOfClass:[NSPredicate class]]) {
|
||||
if ([_hidden isKindOfClass:[NSPredicate class]]){
|
||||
[self.formDescriptor addObserversOfObject:self predicateType:XLPredicateTypeHidden];
|
||||
}
|
||||
|
||||
[self evaluateIsHidden]; // check and update if this row should be hidden.
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
@interface UIView (XLFormAdditions)
|
||||
|
||||
+(instancetype)autolayoutView;
|
||||
+(id)autolayoutView;
|
||||
-(NSLayoutConstraint *)layoutConstraintSameHeightOf:(UIView *)view;
|
||||
-(UIView *)findFirstResponder;
|
||||
-(UITableViewCell<XLFormDescriptorCell> *)formDescriptorCell;
|
||||
|
||||
@@ -27,62 +27,47 @@
|
||||
|
||||
@implementation UIView (XLFormAdditions)
|
||||
|
||||
+ (instancetype)autolayoutView
|
||||
+ (id)autolayoutView
|
||||
{
|
||||
__kindof UIView *view = [self new];
|
||||
UIView *view = [self new];
|
||||
view.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *)layoutConstraintSameHeightOf:(UIView *)view
|
||||
-(NSLayoutConstraint *)layoutConstraintSameHeightOf:(UIView *)view
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeHeight
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:view
|
||||
attribute:NSLayoutAttributeHeight
|
||||
multiplier:1.0
|
||||
constant:0.0];
|
||||
return [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:view attribute:NSLayoutAttributeHeight multiplier:1.0f constant:0.0f];
|
||||
}
|
||||
|
||||
- (UIView *)findFirstResponder
|
||||
{
|
||||
UIView *firstResponder = nil;
|
||||
if (self.isFirstResponder) {
|
||||
firstResponder = self;
|
||||
return self;
|
||||
}
|
||||
else {
|
||||
for (UIView *subView in self.subviews) {
|
||||
UIView *fr = [subView findFirstResponder];
|
||||
if (fr != nil) {
|
||||
firstResponder = fr;
|
||||
|
||||
break;
|
||||
}
|
||||
for (UIView *subView in self.subviews) {
|
||||
UIView *firstResponder = [subView findFirstResponder];
|
||||
if (firstResponder != nil) {
|
||||
return firstResponder;
|
||||
}
|
||||
}
|
||||
|
||||
return firstResponder;
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (UITableViewCell<XLFormDescriptorCell> *)formDescriptorCell
|
||||
{
|
||||
UITableViewCell<XLFormDescriptorCell> * tableViewCell = nil;
|
||||
|
||||
if ([self isKindOfClass:[UITableViewCell class]]) {
|
||||
if ([self conformsToProtocol:@protocol(XLFormDescriptorCell)]){
|
||||
tableViewCell = (UITableViewCell<XLFormDescriptorCell> *)self;
|
||||
return (UITableViewCell<XLFormDescriptorCell> *)self;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
if (self.superview) {
|
||||
UITableViewCell<XLFormDescriptorCell> * tableViewCell = [self.superview formDescriptorCell];
|
||||
if (tableViewCell != nil) {
|
||||
return tableViewCell;
|
||||
}
|
||||
}
|
||||
else if (self.superview) {
|
||||
UITableViewCell<XLFormDescriptorCell> * cell = [self.superview formDescriptorCell];
|
||||
if (cell != nil) {
|
||||
tableViewCell = cell;
|
||||
}
|
||||
}
|
||||
|
||||
return tableViewCell;
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
@interface XLFormRowNavigationAccessoryView : UIToolbar
|
||||
|
||||
@property (nonatomic, weak) UIBarButtonItem *previousButton;
|
||||
@property (nonatomic, weak) UIBarButtonItem *nextButton;
|
||||
@property (nonatomic, weak) UIBarButtonItem *doneButton;
|
||||
@property (nonatomic) UIBarButtonItem *previousButton;
|
||||
@property (nonatomic) UIBarButtonItem *nextButton;
|
||||
@property (nonatomic) UIBarButtonItem *doneButton;
|
||||
|
||||
@end
|
||||
|
||||
@@ -25,6 +25,14 @@
|
||||
|
||||
#import "XLFormRowNavigationAccessoryView.h"
|
||||
|
||||
|
||||
@interface XLFormRowNavigationAccessoryView ()
|
||||
|
||||
@property (nonatomic) UIBarButtonItem *fixedSpace;
|
||||
@property (nonatomic) UIBarButtonItem *flexibleSpace;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XLFormRowNavigationAccessoryView
|
||||
|
||||
@synthesize previousButton = _previousButton;
|
||||
@@ -36,30 +44,55 @@
|
||||
{
|
||||
self = [super initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 44.0)];
|
||||
if (self) {
|
||||
|
||||
UIBarButtonItem *previousButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:105 target:nil action:nil];
|
||||
_previousButton = previousButton;
|
||||
UIBarButtonItem *nextButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:106 target:nil action:nil];
|
||||
_nextButton = nextButton;
|
||||
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:nil action:nil];
|
||||
_doneButton = doneButton;
|
||||
|
||||
UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
|
||||
fixedSpace.width = 22.0;
|
||||
|
||||
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
|
||||
|
||||
self.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth);
|
||||
NSArray * items = [NSArray arrayWithObjects:previousButton,
|
||||
fixedSpace,
|
||||
nextButton,
|
||||
flexibleSpace,
|
||||
doneButton, nil];
|
||||
NSArray * items = [NSArray arrayWithObjects:self.previousButton,
|
||||
self.fixedSpace,
|
||||
self.nextButton,
|
||||
self.flexibleSpace,
|
||||
self.doneButton, nil];
|
||||
[self setItems:items];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
-(UIBarButtonItem *)previousButton
|
||||
{
|
||||
if (_previousButton) return _previousButton;
|
||||
_previousButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:105 target:nil action:nil];
|
||||
return _previousButton;
|
||||
}
|
||||
|
||||
-(UIBarButtonItem *)fixedSpace
|
||||
{
|
||||
if (_fixedSpace) return _fixedSpace;
|
||||
_fixedSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
|
||||
_fixedSpace.width = 22.0;
|
||||
return _fixedSpace;
|
||||
}
|
||||
|
||||
-(UIBarButtonItem *)nextButton
|
||||
{
|
||||
if (_nextButton) return _nextButton;
|
||||
_nextButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:106 target:nil action:nil];
|
||||
return _nextButton;
|
||||
}
|
||||
|
||||
-(UIBarButtonItem *)flexibleSpace
|
||||
{
|
||||
if (_flexibleSpace) return _flexibleSpace;
|
||||
_flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
|
||||
return _flexibleSpace;
|
||||
}
|
||||
|
||||
-(UIBarButtonItem *)doneButton
|
||||
{
|
||||
if (_doneButton) return _doneButton;
|
||||
_doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:nil action:nil];
|
||||
return _doneButton;
|
||||
}
|
||||
|
||||
#pragma mark - Helpers
|
||||
|
||||
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent *)event
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
@interface XLFormTextView : UITextView
|
||||
|
||||
|
||||
@property (nonatomic, copy) NSString *placeholder;
|
||||
@property (nonatomic, copy) UIColor *placeholderColor;
|
||||
@property (nonatomic) NSString *placeholder;
|
||||
@property (nonatomic) UIColor *placeholderColor;
|
||||
|
||||
@property (nonatomic, readonly, weak) UILabel *placeHolderLabel;
|
||||
@property (readonly) UILabel *placeHolderLabel;
|
||||
|
||||
@end
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UITextViewTextDidChangeNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
@@ -67,19 +67,17 @@
|
||||
{
|
||||
if([[self placeholder] length] > 0){
|
||||
if (_placeHolderLabel == nil ){
|
||||
UILabel *placeHolderLabel = [[UILabel alloc] initWithFrame:CGRectMake(4,8,self.bounds.size.width - 16,0)];
|
||||
placeHolderLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
||||
placeHolderLabel.numberOfLines = 0;
|
||||
placeHolderLabel.backgroundColor = [UIColor clearColor];
|
||||
placeHolderLabel.textColor = self.placeholderColor;
|
||||
placeHolderLabel.alpha = 0;
|
||||
placeHolderLabel.tag = 999;
|
||||
[self addSubview:placeHolderLabel];
|
||||
_placeHolderLabel = placeHolderLabel;
|
||||
_placeHolderLabel = [[UILabel alloc] initWithFrame:CGRectMake(4,8,self.bounds.size.width - 16,0)];
|
||||
_placeHolderLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
||||
_placeHolderLabel.numberOfLines = 0;
|
||||
_placeHolderLabel.backgroundColor = [UIColor clearColor];
|
||||
_placeHolderLabel.textColor = self.placeholderColor;
|
||||
_placeHolderLabel.alpha = 0;
|
||||
_placeHolderLabel.tag = 999;
|
||||
[self addSubview:_placeHolderLabel];
|
||||
}
|
||||
_placeHolderLabel.text = self.placeholder;
|
||||
_placeHolderLabel.font = self.font;
|
||||
_placeHolderLabel.textColor = self.placeholderColor;
|
||||
[_placeHolderLabel sizeToFit];
|
||||
[self sendSubviewToBack:_placeHolderLabel];
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
@interface XLFormRegexValidator : XLFormValidator
|
||||
|
||||
@property (nonatomic, copy) NSString *msg;
|
||||
@property (nonatomic, copy) NSString *regex;
|
||||
@property NSString *msg;
|
||||
@property NSString *regex;
|
||||
|
||||
- (instancetype)initWithMsg:(NSString*)msg andRegexString:(NSString*)regex;
|
||||
+ (XLFormRegexValidator *)formRegexValidatorWithMsg:(NSString *)msg regex:(NSString *)regex;
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
@interface XLFormValidationStatus : NSObject
|
||||
|
||||
@property (nonatomic, copy) NSString *msg;
|
||||
@property (nonatomic, assign) BOOL isValid;
|
||||
@property NSString *msg;
|
||||
@property BOOL isValid;
|
||||
@property (nonatomic, weak) XLFormRowDescriptor *rowDescriptor;
|
||||
|
||||
//-(instancetype)initWithMsg:(NSString*)msg andStatus:(BOOL)isValid;
|
||||
|
||||
Reference in New Issue
Block a user