Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 204cad6045 | |||
| e68b57cded | |||
| 0bc600d5a7 | |||
| c2d721f098 | |||
| 2485332846 | |||
| 20b661c41e | |||
| 1e2b5137d6 | |||
| 43abac5c3f | |||
| 77db6b9492 | |||
| 74b26c1e64 | |||
| 085cf31e52 | |||
| 313e5d5d40 | |||
| f7777d9d27 | |||
| 578dea99dd | |||
| 1da30107dc | |||
| 4674c3abaf | |||
| 5ca54fd949 | |||
| e64e5b4885 |
+1
-1
@@ -1,5 +1,5 @@
|
||||
language: objective-c
|
||||
osx_image: xcode7.2
|
||||
osx_image: xcode9
|
||||
before_install:
|
||||
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
|
||||
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
|
||||
|
||||
+6
-1
@@ -1,6 +1,11 @@
|
||||
# Change Log
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
### 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`
|
||||
@@ -134,4 +139,4 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
### Version 1.0.0
|
||||
|
||||
* Initial release
|
||||
* Initial release
|
||||
|
||||
@@ -57,6 +57,7 @@ NSString *const kCountDownTimer = @"countDownTimer";
|
||||
// Date
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDateInline rowType:XLFormRowDescriptorTypeDateInline title:@"Date"];
|
||||
row.value = [NSDate new];
|
||||
[row.cellConfigAtConfigure setObject:[NSLocale localeWithLocaleIdentifier:@"FR_fr" ] forKey:@"locale"];
|
||||
[section addFormRow:row];
|
||||
|
||||
// Time
|
||||
@@ -153,38 +154,13 @@ NSString *const kCountDownTimer = @"countDownTimer";
|
||||
|
||||
-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)formRow oldValue:(id)oldValue newValue:(id)newValue
|
||||
{
|
||||
// super implementation must be called
|
||||
[super formRowDescriptorValueHasChanged:formRow oldValue:oldValue newValue:newValue];
|
||||
if([formRow.tag isEqualToString:kDatePicker])
|
||||
{
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"DatePicker"
|
||||
message:@"Value Has changed!"
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"OK"
|
||||
otherButtonTitles:nil];
|
||||
[message show];
|
||||
#else
|
||||
if ([UIAlertController class]) {
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@"DatePicker"
|
||||
message:@"Value Has changed!"
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:@"OK"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:nil]];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
else{
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"DatePicker"
|
||||
message:@"Value Has changed!"
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"OK"
|
||||
otherButtonTitles:nil];
|
||||
[message show];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
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];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -105,6 +105,11 @@
|
||||
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"];
|
||||
[section addFormRow:row];
|
||||
|
||||
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"megabytes" rowType:XLFormRowDescriptorTypeInfo title:@"Megabytes"];
|
||||
row.valueFormatter = [NSByteCountFormatter new];
|
||||
row.value = @(1024);
|
||||
[section addFormRow:row];
|
||||
|
||||
section = [XLFormSectionDescriptor formSection];
|
||||
[formDescriptor addFormSection:section];
|
||||
|
||||
|
||||
@@ -135,33 +135,13 @@ NSString *const kNotes = @"notes";
|
||||
}
|
||||
[self.tableView endEditing:YES];
|
||||
|
||||
#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
|
||||
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];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#import "XLForm.h"
|
||||
#import "SelectorsFormViewController.h"
|
||||
#import "MultiValuedFormViewController.h"
|
||||
#import "MultivaluedFormViewController.h"
|
||||
|
||||
|
||||
@implementation MultivaluedFormViewController
|
||||
@@ -85,95 +85,45 @@
|
||||
|
||||
-(void)addDidTouch:(UIBarButtonItem * __unused)sender
|
||||
{
|
||||
#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
|
||||
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_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() <UIActionSheetDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate>
|
||||
@interface XLFormImageSelectorCell() <UINavigationControllerDelegate, UIImagePickerControllerDelegate>
|
||||
|
||||
@property (nonatomic) UIImage * defaultImage;
|
||||
@property (nonatomic) NSURLRequest * imageRequest;
|
||||
@@ -92,57 +92,36 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
|
||||
|
||||
-(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller
|
||||
{
|
||||
#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
|
||||
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];
|
||||
}
|
||||
|
||||
#pragma mark - LayoutConstraints
|
||||
@@ -213,32 +192,6 @@ 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,32 +134,13 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
__typeof(self) __weak weakSelf = self;
|
||||
buttonLeftAlignedRow.action.formBlock = ^(XLFormRowDescriptor * sender){
|
||||
if ([[sender.sectionDescriptor.formDescriptor formRowWithTag:kSwitchBool].value boolValue]){
|
||||
#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
|
||||
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];
|
||||
}
|
||||
[weakSelf deselectFormRow:sender];
|
||||
};
|
||||
@@ -196,33 +177,13 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
|
||||
-(void)didTouchButton:(XLFormRowDescriptor *)sender
|
||||
{
|
||||
if ([[sender.sectionDescriptor.formDescriptor formRowWithTag:kSwitchBool].value boolValue]){
|
||||
#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
|
||||
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];
|
||||
}
|
||||
[self deselectFormRow:sender];
|
||||
}
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@
|
||||
|
||||
MKPinAnnotationView *pinAnnotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation
|
||||
reuseIdentifier:@"annotation"];
|
||||
pinAnnotationView.pinColor = MKPinAnnotationColorRed;
|
||||
pinAnnotationView.pinTintColor = [UIColor redColor];
|
||||
pinAnnotationView.draggable = YES;
|
||||
pinAnnotationView.animatesDrop = YES;
|
||||
return pinAnnotationView;
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
#import "XLFormRowDescriptor.h"
|
||||
#import "XLRemoteDataStoreController.h"
|
||||
|
||||
@interface UsersTableViewController : XLRemoteDataStoreController <XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController>
|
||||
@interface UsersTableViewController : XLRemoteDataStoreController <XLFormRowDescriptorViewController>
|
||||
|
||||
@property BOOL isSearchResultsController;
|
||||
@property NSLayoutConstraint *topConstraint;
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
@@ -124,7 +124,6 @@
|
||||
|
||||
@implementation UsersTableViewController
|
||||
@synthesize rowDescriptor = _rowDescriptor;
|
||||
@synthesize popoverController = __popoverController;
|
||||
@synthesize searchController = _searchController;
|
||||
@synthesize searchResultController = _searchResultController;
|
||||
|
||||
@@ -205,15 +204,16 @@ static NSString *const kCellIdentifier = @"CellIdentifier";
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
NSDictionary *dataItem = [self.dataStore dataAtIndexPath:indexPath];
|
||||
|
||||
|
||||
self.rowDescriptor.value = dataItem;
|
||||
|
||||
if (self.popoverController){
|
||||
[self.popoverController dismissPopoverAnimated:YES];
|
||||
[self.popoverController.delegate popoverControllerDidDismissPopover:self.popoverController];
|
||||
}
|
||||
else if ([self.parentViewController isKindOfClass:[UINavigationController class]]){
|
||||
UIViewController *popoverController = self.presentedViewController;
|
||||
if (popoverController && popoverController.modalPresentationStyle == UIModalPresentationPopover) {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
} else if ([self.parentViewController isKindOfClass:[UINavigationController class]]) {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
} else if ([self.presentingViewController isKindOfClass:[UsersTableViewController class]]) {
|
||||
[[self.presentingViewController navigationController] popViewControllerAnimated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,10 +243,12 @@ static NSString *const kCellIdentifier = @"CellIdentifier";
|
||||
-(UsersTableViewController *)searchResultController
|
||||
{
|
||||
if (_searchResultController) return _searchResultController;
|
||||
_searchResultController = [[UsersTableViewController alloc]init];
|
||||
UsersTableViewController *usersViewController = [[UsersTableViewController alloc] init];
|
||||
usersViewController.rowDescriptor = self.rowDescriptor;
|
||||
_searchResultController = usersViewController;
|
||||
_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, '8.0'
|
||||
platform :ios, '9.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 (3.1.2)
|
||||
- XLForm (4.0.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- AFNetworking (~> 2.0)
|
||||
@@ -71,8 +71,8 @@ SPEC CHECKSUMS:
|
||||
JVFloatLabeledTextField: 58a3a32cfb800e5b224f676987e7c13abf50a14d
|
||||
SHSPhoneComponent: 4cec0653a150ad63cbc52b0c8b29ce2d3c9c26f0
|
||||
XLData: df725c6179e2e0c80bf56a1ecad9afd169707a6d
|
||||
XLForm: 6bb3c20857e2983cf494cb8b4d666c2a24673d5e
|
||||
XLForm: 04110197c12187dd28a6c7295d3d8b95f4fdb4de
|
||||
|
||||
PODFILE CHECKSUM: 80615792e859be64c95add3bb57c1596234faf95
|
||||
PODFILE CHECKSUM: 64fbcd03a2c13762b2c18e3938cc8008807937c9
|
||||
|
||||
COCOAPODS: 1.0.0
|
||||
COCOAPODS: 1.3.1
|
||||
|
||||
@@ -482,12 +482,12 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 2850C62418D0F707002B7D0A /* Build configuration list for PBXNativeTarget "XLForm" */;
|
||||
buildPhases = (
|
||||
EBE0335CCC7588D83B89A92A /* 📦 Check Pods Manifest.lock */,
|
||||
EBE0335CCC7588D83B89A92A /* [CP] Check Pods Manifest.lock */,
|
||||
2850C5F418D0F706002B7D0A /* Sources */,
|
||||
2850C5F518D0F706002B7D0A /* Frameworks */,
|
||||
2850C5F618D0F706002B7D0A /* Resources */,
|
||||
32EB30E0A90A4E91864B1D3C /* 📦 Embed Pods Frameworks */,
|
||||
DE3D12F5596780A66C6C3D4A /* 📦 Copy Pods Resources */,
|
||||
32EB30E0A90A4E91864B1D3C /* [CP] Embed Pods Frameworks */,
|
||||
DE3D12F5596780A66C6C3D4A /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -504,7 +504,7 @@
|
||||
2850C5F018D0F706002B7D0A /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0700;
|
||||
LastUpgradeCheck = 0900;
|
||||
ORGANIZATIONNAME = Xmartlabs;
|
||||
};
|
||||
buildConfigurationList = 2850C5F318D0F706002B7D0A /* Build configuration list for PBXProject "XLForm" */;
|
||||
@@ -542,14 +542,14 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
32EB30E0A90A4E91864B1D3C /* 📦 Embed Pods Frameworks */ = {
|
||||
32EB30E0A90A4E91864B1D3C /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Embed Pods Frameworks";
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -557,34 +557,40 @@
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-XLForm/Pods-XLForm-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
DE3D12F5596780A66C6C3D4A /* 📦 Copy Pods Resources */ = {
|
||||
DE3D12F5596780A66C6C3D4A /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/Pods/Target Support Files/Pods-XLForm/Pods-XLForm-resources.sh",
|
||||
"${PODS_ROOT}/../../../XLForm/XLForm.bundle",
|
||||
);
|
||||
name = "📦 Copy Pods Resources";
|
||||
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-XLForm/Pods-XLForm-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
EBE0335CCC7588D83B89A92A /* 📦 Check Pods Manifest.lock */ = {
|
||||
EBE0335CCC7588D83B89A92A /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "📦 Check Pods Manifest.lock";
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-XLForm-checkManifestLockResult.txt",
|
||||
);
|
||||
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";
|
||||
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;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
@@ -658,19 +664,30 @@
|
||||
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;
|
||||
"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",
|
||||
@@ -683,7 +700,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
@@ -697,25 +714,36 @@
|
||||
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;
|
||||
"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 = 8.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
@@ -730,7 +758,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "XLForm/XLForm-Prefix.pch";
|
||||
INFOPLIST_FILE = "XLForm/XLForm-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -748,7 +776,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "XLForm/XLForm-Prefix.pch";
|
||||
INFOPLIST_FILE = "XLForm/XLForm-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
platform :ios, '8.0'
|
||||
platform :ios, '9.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 = (
|
||||
DD7B43598E698717584375E9 /* libPods-SwiftExample.a in Frameworks */,
|
||||
649437BA8D5B7C59BBDB7B92 /* libPods-SwiftExample.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -100,8 +100,8 @@
|
||||
children = (
|
||||
2847A6A01AAF2679000A2ABE /* SwiftExample */,
|
||||
2847A69F1AAF2679000A2ABE /* Products */,
|
||||
7A12A831117D9B4D152E0A51 /* Pods */,
|
||||
402AE3EC1FACD058DCF0A2D3 /* Frameworks */,
|
||||
E9F3DD7ACEF5AAF92FCE6E24 /* Pods */,
|
||||
3D93F92C6A8B49B82B452B67 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -324,23 +324,14 @@
|
||||
path = SwiftExample/Dates;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
402AE3EC1FACD058DCF0A2D3 /* Frameworks */ = {
|
||||
3D93F92C6A8B49B82B452B67 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9CFB9BA3A82D5F6FE7CCE5A5 /* libPods-SwiftExample.a */,
|
||||
E006C7F7FF8E967AA8661BC9 /* 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 = (
|
||||
@@ -349,6 +340,15 @@
|
||||
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 = (
|
||||
21FCE00817B1AE1029F382A4 /* 📦 Check Pods Manifest.lock */,
|
||||
89E8536C00EFF5D0377E1AE9 /* [CP] Check Pods Manifest.lock */,
|
||||
2847A69A1AAF2679000A2ABE /* Sources */,
|
||||
2847A69B1AAF2679000A2ABE /* Frameworks */,
|
||||
2847A69C1AAF2679000A2ABE /* Resources */,
|
||||
A0F2DA95250A4C3E69515D96 /* 📦 Copy Pods Resources */,
|
||||
DCA1F7B1D7E04613B3E151C1 /* 📦 Embed Pods Frameworks */,
|
||||
9BD9BF77E99A8DF4A44D2DB8 /* [CP] Embed Pods Frameworks */,
|
||||
DC50100813F1902A0CFCE009 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -380,12 +380,12 @@
|
||||
attributes = {
|
||||
LastSwiftMigration = 0700;
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0800;
|
||||
LastUpgradeCheck = 0900;
|
||||
ORGANIZATIONNAME = Xmartlabs;
|
||||
TargetAttributes = {
|
||||
2847A69D1AAF2679000A2ABE = {
|
||||
CreatedOnToolsVersion = 6.2;
|
||||
LastSwiftMigration = 0800;
|
||||
LastSwiftMigration = 0900;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -423,44 +423,32 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
21FCE00817B1AE1029F382A4 /* 📦 Check Pods Manifest.lock */ = {
|
||||
89E8536C00EFF5D0377E1AE9 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "📦 Check Pods Manifest.lock";
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-SwiftExample-checkManifestLockResult.txt",
|
||||
);
|
||||
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";
|
||||
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;
|
||||
};
|
||||
A0F2DA95250A4C3E69515D96 /* 📦 Copy Pods Resources */ = {
|
||||
9BD9BF77E99A8DF4A44D2DB8 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
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";
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -468,6 +456,24 @@
|
||||
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 */
|
||||
@@ -516,14 +522,20 @@
|
||||
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;
|
||||
@@ -546,7 +558,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -563,14 +575,20 @@
|
||||
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;
|
||||
@@ -586,7 +604,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
@@ -597,7 +615,7 @@
|
||||
};
|
||||
2847A6BE1AAF2679000A2ABE /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 420D9BAB7B0D2AF9487DD060 /* Pods-SwiftExample.debug.xcconfig */;
|
||||
baseConfigurationReference = F019783EE34BD17E2BA41467 /* Pods-SwiftExample.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
||||
@@ -606,13 +624,14 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "SwiftExample/SwiftExample-Bridging-Header.h";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
2847A6BF1AAF2679000A2ABE /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 2EB9C638FC2450A0B9786D1E /* Pods-SwiftExample.release.xcconfig */;
|
||||
baseConfigurationReference = CD0A6F89B9CD5843CA297E52 /* Pods-SwiftExample.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
||||
@@ -621,7 +640,8 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "SwiftExample/SwiftExample-Bridging-Header.h";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
+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: kFontSize)
|
||||
result.floatingLabel.font = .boldSystemFont(ofSize: kFontSize)
|
||||
result.font = UIFont.systemFont(ofSize: FloatLabeledTextFieldCell.kFontSize)
|
||||
result.floatingLabel.font = .boldSystemFont(ofSize: FloatLabeledTextFieldCell.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: [NSForegroundColorAttributeName: UIColor.lightGray])
|
||||
floatLabeledTextField.attributedPlaceholder = NSAttributedString(string: rowDescriptor.title ?? "" , attributes: [NSAttributedStringKey.foregroundColor: 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
|
||||
|
||||
func valueChanged() {
|
||||
@objc func valueChanged() {
|
||||
inlineRowDescriptor!.value = inlineRowDescriptor!.selectorOptions![segmentedControl.selectedSegmentIndex]
|
||||
formViewController().updateFormRow(inlineRowDescriptor)
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class XLFormRatingCell : XLFormBaseCell {
|
||||
|
||||
//MARK: Events
|
||||
|
||||
func rateChanged(_ ratingView : XLRatingView){
|
||||
@objc 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(attributes: [NSFontAttributeName: button.titleLabel!.font])
|
||||
let titleSize : CGSize = (button.titleLabel!.text! as NSString).size(withAttributes: [NSAttributedStringKey.font: button.titleLabel!.font])
|
||||
button.imageEdgeInsets = UIEdgeInsetsMake(-(titleSize.height + spacing), 0.0, 0.0, -titleSize.width)
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class DatesFormViewController: XLFormViewController {
|
||||
}
|
||||
|
||||
|
||||
func disableEnable(_ button : UIBarButtonItem){
|
||||
@objc func disableEnable(_ button : UIBarButtonItem){
|
||||
form.isDisabled = !form.isDisabled
|
||||
button.title = form.isDisabled ? "Enable" : "Disable"
|
||||
tableView.endEditing(true)
|
||||
@@ -76,6 +76,7 @@ class DatesFormViewController: XLFormViewController {
|
||||
// Date
|
||||
row = XLFormRowDescriptor(tag: Tags.DateInline, rowType: XLFormRowDescriptorTypeDateInline, title:"Date")
|
||||
row.value = Date()
|
||||
row.cellConfigAtConfigure["locale"] = Locale(identifier: "FR_fr")
|
||||
section.addFormRow(row)
|
||||
|
||||
// Time
|
||||
@@ -153,8 +154,10 @@ 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 alertView = UIAlertView(title: "DatePicker", message: "Value Has changed!", delegate: self, cancelButtonTitle: "OK")
|
||||
alertView.show()
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,12 +131,8 @@ class User: NSObject, XLFormOptionObject {
|
||||
|
||||
}
|
||||
|
||||
class UsersTableViewController : UITableViewController, XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController {
|
||||
|
||||
|
||||
class UsersTableViewController : UITableViewController, XLFormRowDescriptorViewController {
|
||||
var rowDescriptor : XLFormRowDescriptor?
|
||||
var popoverController : UIPopoverController?
|
||||
|
||||
var userCell : UserCell?
|
||||
|
||||
fileprivate let kUserCellIdentifier = "UserCell"
|
||||
@@ -197,9 +193,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 porpOver = self.popoverController {
|
||||
porpOver.dismiss(animated: true)
|
||||
porpOver.delegate?.popoverControllerDidDismissPopover!(porpOver)
|
||||
|
||||
if let popOver = self.presentedViewController, popOver.modalPresentationStyle == .popover {
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
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(_:)))
|
||||
}
|
||||
|
||||
func savePressed(_ button: UIBarButtonItem)
|
||||
@objc func savePressed(_ button: UIBarButtonItem)
|
||||
{
|
||||
let validationErrors : Array<NSError> = self.formValidationErrors() as! Array<NSError>
|
||||
if (validationErrors.count > 0){
|
||||
@@ -145,8 +145,11 @@ class InputsFormViewController : XLFormViewController {
|
||||
return
|
||||
}
|
||||
self.tableView.endEditing(true)
|
||||
let alertView = UIAlertView(title: "Valid Form", message: "No errors found", delegate: self, cancelButtonTitle: "OK")
|
||||
alertView.show()
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+30
-27
@@ -83,42 +83,45 @@ class MultivaluedFormViewController : XLFormViewController {
|
||||
|
||||
//MARK: - Actions
|
||||
|
||||
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 {
|
||||
@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 {
|
||||
// remove last section
|
||||
form.removeFormSection(at: UInt(form.formSections.count - 1))
|
||||
self.form.removeFormSection(at: UInt(self.form.formSections.count - 1))
|
||||
}
|
||||
}
|
||||
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 addSectionAction = UIAlertAction(title: "Add a section at the end", style: .default, handler: { [weak self] alert in
|
||||
guard let `self` = self else { return }
|
||||
|
||||
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)
|
||||
form.addFormSection(newSection)
|
||||
}
|
||||
else {
|
||||
form.isDisabled = !self.form.isDisabled
|
||||
tableView.endEditing(true)
|
||||
tableView.reloadData()
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class MultivaluedOnlyReorderViewController : XLFormViewController {
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
@@ -245,7 +248,7 @@ class MultivaluedOnlyDeleteViewController : XLFormViewController {
|
||||
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Editing", style: .plain, target: self, action: #selector(MultivaluedOnlyDeleteViewController.toggleEditing(_:)))
|
||||
}
|
||||
|
||||
func toggleEditing(_ sender : UIBarButtonItem) {
|
||||
@objc func toggleEditing(_ sender : UIBarButtonItem) {
|
||||
tableView.setEditing(!tableView.isEditing, animated: true)
|
||||
sender.title = tableView.isEditing ? "Editing" : "Not Editing"
|
||||
}
|
||||
|
||||
@@ -126,8 +126,10 @@ 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 alertView = UIAlertView(title: "Switch is ON", message: "Button has checked the switch value...", delegate: self, cancelButtonTitle: "OK")
|
||||
alertView.show()
|
||||
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)
|
||||
}
|
||||
self?.deselectFormRow(sender)
|
||||
}
|
||||
@@ -164,10 +166,12 @@ class OthersFormViewController : XLFormViewController {
|
||||
self.form = form
|
||||
}
|
||||
|
||||
func didTouchButton(_ sender: XLFormRowDescriptor) {
|
||||
@objc func didTouchButton(_ sender: XLFormRowDescriptor) {
|
||||
if (sender.sectionDescriptor.formDescriptor.formRow(withTag: Tags.SwitchBool)?.value as AnyObject).boolValue == true{
|
||||
let alertView = UIAlertView(title: "Switch is ON", message: "Button has checked the switch value...", delegate: self, cancelButtonTitle: "OK")
|
||||
alertView.show()
|
||||
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)
|
||||
}
|
||||
self.deselectFormRow(sender)
|
||||
}
|
||||
@@ -183,7 +187,7 @@ class OthersFormViewController : XLFormViewController {
|
||||
}
|
||||
|
||||
|
||||
func disableEnable(_ button : UIBarButtonItem) {
|
||||
@objc 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 = [NSStrikethroughStyleAttributeName : NSUnderlineStyle.styleSingle.rawValue]
|
||||
let strikeThroughAttribute = [NSAttributedStringKey.strikethroughStyle : NSUnderlineStyle.styleSingle.rawValue]
|
||||
let strikeThroughText = NSAttributedString(string: newDetailText, attributes: strikeThroughAttribute)
|
||||
endDateDescriptor.cellConfig["detailTextLabel.attributedText"] = strikeThroughText
|
||||
updateFormRow(endDateDescriptor)
|
||||
@@ -210,12 +210,12 @@ class NativeEventFormViewController : XLFormViewController {
|
||||
}
|
||||
}
|
||||
|
||||
func cancelPressed(_ button: UIBarButtonItem){
|
||||
@objc func cancelPressed(_ button: UIBarButtonItem){
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
|
||||
func savePressed(_ button: UIBarButtonItem){
|
||||
@objc 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
|
||||
}
|
||||
|
||||
func disableEnable(_ button : UIBarButtonItem)
|
||||
@objc func disableEnable(_ button : UIBarButtonItem)
|
||||
{
|
||||
form.isDisabled = !form.isDisabled
|
||||
button.title = form.isDisabled ? "Enable" : "Disable"
|
||||
|
||||
@@ -118,7 +118,7 @@ class ValidationExamplesFormViewController : XLFormViewController {
|
||||
|
||||
//MARK: Actions
|
||||
|
||||
func validateForm(_ buttonItem: UIBarButtonItem) {
|
||||
@objc func validateForm(_ buttonItem: UIBarButtonItem) {
|
||||
let array = formValidationErrors()
|
||||
for errorItem in array! {
|
||||
let error = errorItem as! NSError
|
||||
|
||||
@@ -6,7 +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 looking for Swift native implementation we have recently created [Eureka], a complete re-design of XLForm in Swift.** *Do not panic, We will continue maintaining and improving XLForm, obj-c rocks!!*
|
||||
**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
|
||||
--------------
|
||||
@@ -15,7 +15,7 @@ XLForm is the most flexible and powerful iOS library to create dynamic table-vie
|
||||
|
||||
XLForm provides a very powerful DSL (Domain Specific Language) used to create a form. It keeps track of this specification on runtime, updating the UI on the fly.
|
||||
|
||||
#####Let's see the iOS Calendar Event Form created using XLForm
|
||||
##### Let's see the iOS Calendar Event Form created using XLForm
|
||||
|
||||
|
||||

|
||||
@@ -182,7 +182,7 @@ How to run XLForm examples
|
||||
|
||||
Rows
|
||||
---------------------
|
||||
####Input Rows
|
||||
#### Input Rows
|
||||
|
||||

|
||||
|
||||
@@ -253,7 +253,7 @@ Will be represented by a `UITextView` with `UITextAutocorrectionTypeDefault`, `U
|
||||
|
||||
|
||||
|
||||
####Selector Rows
|
||||
#### Selector Rows
|
||||
|
||||
Selector rows allow us to select a value or values from a list. XLForm supports 8 types of selectors out of the box:
|
||||
|
||||
@@ -320,7 +320,7 @@ This is the protocol declaration:
|
||||
```
|
||||
|
||||
|
||||
####Date & Time Rows
|
||||
#### Date & Time Rows
|
||||
|
||||
XLForms supports 3 types of dates: `Date`, `DateTime` , `Time` and `Countdown Timer` and it's able to present the `UIDatePicker` control in 2 different ways, inline and non-inline.
|
||||
|
||||
@@ -427,7 +427,7 @@ section.addFormRow(row)
|
||||
self.form = form;
|
||||
|
||||
```
|
||||
####Boolean Rows
|
||||
#### Boolean Rows
|
||||
|
||||
XLForms supports 2 types of boolean controls:
|
||||
|
||||
@@ -445,9 +445,9 @@ static NSString *const XLFormRowDescriptorTypeBooleanSwitch = @"booleanSwitch";
|
||||
We can also simulate other types of Boolean rows using any of the Selector Row Types introduced in the [Selector Rows section](#selector-rows).
|
||||
|
||||
|
||||
####Other Rows
|
||||
#### Other Rows
|
||||
|
||||
#####Stepper
|
||||
##### Stepper
|
||||
|
||||
XLForms supports counting using UIStepper control:
|
||||
|
||||
@@ -469,7 +469,7 @@ You can set the stepper paramaters easily:
|
||||
[row.cellConfigAtConfigure setObject:@100 forKey:@"stepControl.maximumValue"];
|
||||
```
|
||||
|
||||
#####Slider
|
||||
##### Slider
|
||||
|
||||
XLForms supports counting using UISlider control:
|
||||
|
||||
@@ -490,11 +490,11 @@ You can adjust the slider for your own interests very easily:
|
||||
|
||||
Set `steps` to `@(0)` to disable the steps functionality.
|
||||
|
||||
#####Info
|
||||
##### Info
|
||||
|
||||
Sometimes our apps needs to show data that are not editable. XLForm provides us with `XLFormRowDescriptorTypeInfo` row type to display not editable info. An example of usage would be showing the app version in the settings part of an app.
|
||||
|
||||
#####Button
|
||||
##### Button
|
||||
|
||||
Apart from data entry rows, not editable rows and selectors, XLForm has a button row `XLFormRowDescriptorTypeButton` that allows us to do any action when selected. It can be configured using a block (clousure), a selector, a segue identifier, segue class or specifing a view controller to be presented. ViewController specification could be done by setting up the view controller class, the view controller storyboard Id or a nib name. Nib name must match view controller class name.
|
||||
|
||||
@@ -767,7 +767,7 @@ For instance if we want to show or hide a row depending on the value of another
|
||||
Make a row or section invisible depending on other rows values
|
||||
--------------------------------
|
||||
|
||||
###Summary
|
||||
### Summary
|
||||
|
||||
XLForm allows you to define dependencies between rows so that if the value of one row is changed, the behaviour of another one changes automatically. For example, you might have a form where you question the user if he/she has pets. If the answer is 'yes' you might want to ask how their names are.
|
||||
So you can make a row invisible and visible again based on the values of other rows. The same happens with sections.
|
||||
@@ -777,7 +777,7 @@ Take a look at the following example:
|
||||
|
||||
Of course, you could also do this manually by observing the value of some rows and deleting and adding rows accordingly, but that would be a lot of work which is already done.
|
||||
|
||||
###How it works
|
||||
### How it works
|
||||
|
||||
To make the appearance and disappearance of rows and sections automatic, there is a property in each descriptor:
|
||||
|
||||
@@ -897,6 +897,25 @@ section.addFormRow(row)
|
||||
FAQ
|
||||
-------
|
||||
|
||||
#### How to customize the header and/or footer of a section
|
||||
|
||||
For this you should use the UITableViewDelegate methods in your XLFormViewController.
|
||||
This means you should implement one or both of these:
|
||||
|
||||
```objc
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
|
||||
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
|
||||
```
|
||||
|
||||
Also you might want to implement the following methods to specify the height for these views:
|
||||
|
||||
```objc
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||||
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
|
||||
```
|
||||
|
||||
#### How to assign the first responder on form appearance
|
||||
|
||||
Assign the first responder when the form is shown is as simple as setting the property `assignFirstResponderOnShow` to `YES`. By default the value of the property is `NO`.
|
||||
@@ -1008,7 +1027,7 @@ row.cellConfig.setObject(UIFont(name: "AppleSDGothicNeo-Regular", size: 17)!, fo
|
||||
|
||||
For further details, please take a look at [UICustomizationFormViewController.m](/Examples/Objective-C/Examples/UICustomization/UICustomizationFormViewController.m) example.
|
||||
|
||||
####How to set min/max for date cells?
|
||||
#### How to set min/max for date cells?
|
||||
|
||||
Each XLFormDateCell has a `minimumDate` and a `maximumDate` property. To set a datetime row to be a value in the next three days you would do as follows:
|
||||
|
||||
@@ -1107,7 +1126,7 @@ Installation
|
||||
## CocoaPods
|
||||
|
||||
1. Add the following line in the project's Podfile file:
|
||||
`pod 'XLForm', '~> 3.0'`.
|
||||
`pod 'XLForm', '~> 4.0'`.
|
||||
2. Run the command `pod install` from the Podfile folder directory.
|
||||
|
||||
XLForm **has no** dependencies over other pods.
|
||||
@@ -1137,7 +1156,7 @@ For further details on how to create and configure the bridging header file visi
|
||||
In your `Cartfile` add:
|
||||
|
||||
```
|
||||
github "xmartlabs/XLForm" ~> 3.0
|
||||
github "xmartlabs/XLForm" ~> 4.0
|
||||
```
|
||||
|
||||
## Using git submodules
|
||||
@@ -1160,8 +1179,8 @@ Requirements
|
||||
-----------------------------
|
||||
|
||||
* ARC
|
||||
* iOS 7.0 and above
|
||||
* XCode 6.3+
|
||||
* iOS 9.0 and above
|
||||
* XCode 9.0+
|
||||
|
||||
|
||||
Release Notes
|
||||
|
||||
@@ -3,7 +3,7 @@ include FileUtils::Verbose
|
||||
namespace :test do
|
||||
desc "Run the XLForm Tests"
|
||||
task :ios do
|
||||
run_tests('XLForm Tests', 'iphonesimulator9.2')
|
||||
run_tests('XLForm Tests', 'iphonesimulator11.0')
|
||||
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 'name=iPhone 6' -configuration Release clean test | xcpretty -c ; exit ${PIPESTATUS[0]}") rescue nil
|
||||
sh("xcodebuild -workspace 'Tests/XLForm Tests.xcworkspace' -scheme '#{scheme}' -sdk '#{sdk}' -destination 'OS=11.0,name=iPhone 8' -configuration Release clean test | xcpretty -c ; exit ${PIPESTATUS[0]}") rescue nil
|
||||
end
|
||||
|
||||
def tests_failed
|
||||
|
||||
+3
-2
@@ -2,8 +2,9 @@ source 'https://github.com/CocoaPods/Specs.git'
|
||||
project 'XLForm Tests'
|
||||
inhibit_all_warnings!
|
||||
|
||||
platform :ios, '7.0'
|
||||
platform :ios, '9.0'
|
||||
|
||||
target 'XLForm Tests' do
|
||||
pod 'Expecta', '~> 0.3.0'
|
||||
pod 'Expecta', '~> 1.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,17 +33,14 @@
|
||||
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>"; };
|
||||
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>"; };
|
||||
8189C74AF1BF64FDF4D14AE3 /* libPods-XLForm Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-XLForm Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BFD111831AD8323900943D23 /* XLTestHideAndShow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLTestHideAndShow.m; path = Test/XLTestHideAndShow.m; 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; };
|
||||
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>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -54,20 +51,29 @@
|
||||
28657A3E1990879200CE8180 /* XCTest.framework in Frameworks */,
|
||||
28657A421990879200CE8180 /* UIKit.framework in Frameworks */,
|
||||
28657A401990879200CE8180 /* Foundation.framework in Frameworks */,
|
||||
17538872B9BB29167787CF50 /* libPods-XLForm Tests.a in Frameworks */,
|
||||
39585558ED414BFBE6FFB93C /* 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 */,
|
||||
52B313F2682BC45F8E9E8132 /* Pods */,
|
||||
142BA587E51B2D88244F04F1 /* Pods */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -85,8 +91,7 @@
|
||||
28657A3D1990879200CE8180 /* XCTest.framework */,
|
||||
28657A3F1990879200CE8180 /* Foundation.framework */,
|
||||
28657A411990879200CE8180 /* UIKit.framework */,
|
||||
CEC7E8601D7342BFAF4C4060 /* libPods.a */,
|
||||
E68572C5C8328F0F177BBCA1 /* libPods-XLForm Tests.a */,
|
||||
8189C74AF1BF64FDF4D14AE3 /* libPods-XLForm Tests.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
@@ -134,17 +139,6 @@
|
||||
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 */
|
||||
@@ -152,12 +146,12 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 28657A4C1990879200CE8180 /* Build configuration list for PBXNativeTarget "XLForm Tests" */;
|
||||
buildPhases = (
|
||||
6B058765CC1143829C6943B9 /* [CP] Check Pods Manifest.lock */,
|
||||
29CB07B4E0344AEB95FE5406 /* [CP] Check Pods Manifest.lock */,
|
||||
28657A361990879200CE8180 /* Sources */,
|
||||
28657A371990879200CE8180 /* Frameworks */,
|
||||
28657A381990879200CE8180 /* Resources */,
|
||||
3E5FCF05A57F40C6AF367F6D /* [CP] Copy Pods Resources */,
|
||||
6A2C507B76209618EDA57426 /* [CP] Embed Pods Frameworks */,
|
||||
51F3E228D166F2E8BF8C889E /* [CP] Embed Pods Frameworks */,
|
||||
7E96395A3A94BDD9487AE471 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -174,7 +168,7 @@
|
||||
28657A3019907FBE00CE8180 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0610;
|
||||
LastUpgradeCheck = 0900;
|
||||
};
|
||||
buildConfigurationList = 28657A3319907FBE00CE8180 /* Build configuration list for PBXProject "XLForm Tests" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
@@ -205,22 +199,25 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
3E5FCF05A57F40C6AF367F6D /* [CP] Copy Pods Resources */ = {
|
||||
29CB07B4E0344AEB95FE5406 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-XLForm Tests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests-resources.sh\"\n";
|
||||
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;
|
||||
};
|
||||
6A2C507B76209618EDA57426 /* [CP] Embed Pods Frameworks */ = {
|
||||
51F3E228D166F2E8BF8C889E /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
@@ -235,19 +232,22 @@
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
6B058765CC1143829C6943B9 /* [CP] Check Pods Manifest.lock */ = {
|
||||
7E96395A3A94BDD9487AE471 /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests-resources.sh",
|
||||
"${PODS_ROOT}/../../XLForm/XLForm.bundle",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}",
|
||||
);
|
||||
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";
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
@@ -284,6 +284,31 @@
|
||||
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;
|
||||
@@ -291,12 +316,36 @@
|
||||
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 = 35038A584FCFD0693D23F189 /* Pods-XLForm Tests.debug.xcconfig */;
|
||||
baseConfigurationReference = F9D7EFDB6BD5884E5923B6AC /* Pods-XLForm Tests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
@@ -334,9 +383,10 @@
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = "XLForm Tests/XLForm Tests-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
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;
|
||||
@@ -345,7 +395,7 @@
|
||||
};
|
||||
28657A4E1990879200CE8180 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 3BE0FA85B15844909EF36AB4 /* Pods-XLForm Tests.release.xcconfig */;
|
||||
baseConfigurationReference = D5A9B3DB06904B24F1A8EA24 /* Pods-XLForm Tests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
@@ -377,8 +427,9 @@
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = "XLForm Tests/XLForm Tests-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
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 = "0610"
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -23,10 +23,11 @@
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
@@ -39,15 +40,19 @@
|
||||
</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
|
||||
@@ -62,10 +67,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>com.xmartlabs.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</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 = '3.3.0'
|
||||
s.version = '4.0.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 = '7.0'
|
||||
s.ios.deployment_target = '9.0'
|
||||
s.ios.frameworks = 'UIKit', 'Foundation', 'CoreGraphics'
|
||||
s.resource = 'XLForm/XLForm.bundle'
|
||||
end
|
||||
|
||||
@@ -414,7 +414,7 @@
|
||||
E267FD171BE8048900F86B42 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0710;
|
||||
LastUpgradeCheck = 0900;
|
||||
ORGANIZATIONNAME = XLForm;
|
||||
TargetAttributes = {
|
||||
E267FD1F1BE8048900F86B42 = {
|
||||
@@ -505,13 +505,21 @@
|
||||
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;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
@@ -534,7 +542,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -552,13 +560,21 @@
|
||||
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;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
@@ -575,7 +591,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -588,6 +604,7 @@
|
||||
E267FD291BE8048900F86B42 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
@@ -604,6 +621,7 @@
|
||||
E267FD2A1BE8048900F86B42 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0710"
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -26,6 +26,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
@@ -36,6 +37,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
@implementation XLFormDateCell
|
||||
{
|
||||
UIColor * _beforeChangeColor;
|
||||
NSDateFormatter *_dateFormatter;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,6 +110,7 @@
|
||||
{
|
||||
[super configure];
|
||||
self.formDatePickerMode = XLFormDateDatePickerModeGetFromRowDescriptor;
|
||||
_dateFormatter = [[NSDateFormatter alloc] init];
|
||||
}
|
||||
|
||||
-(void)update
|
||||
@@ -173,10 +175,14 @@
|
||||
}
|
||||
}
|
||||
if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeDate] || [self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeDateInline]){
|
||||
return [NSDateFormatter localizedStringFromDate:date dateStyle:NSDateFormatterMediumStyle timeStyle:NSDateFormatterNoStyle];
|
||||
_dateFormatter.dateStyle = NSDateFormatterMediumStyle;
|
||||
_dateFormatter.timeStyle = NSDateFormatterNoStyle;
|
||||
return [_dateFormatter stringFromDate:date];
|
||||
}
|
||||
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeTime] || [self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeTimeInline]){
|
||||
return [NSDateFormatter localizedStringFromDate:date dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle];
|
||||
_dateFormatter.dateStyle = NSDateFormatterNoStyle;
|
||||
_dateFormatter.timeStyle = NSDateFormatterShortStyle;
|
||||
return [_dateFormatter stringFromDate:date];
|
||||
}
|
||||
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeCountDownTimer] || [self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeCountDownTimerInline]){
|
||||
NSCalendar *calendar = [NSCalendar currentCalendar];
|
||||
@@ -184,7 +190,9 @@
|
||||
NSDateComponents *time = [calendar components:NSCalendarUnitHour | NSCalendarUnitMinute fromDate:date];
|
||||
return [NSString stringWithFormat:@"%ld%@ %ldmin", (long)[time hour], (long)[time hour] == 1 ? @"hour" : @"hours", (long)[time minute]];
|
||||
}
|
||||
return [NSDateFormatter localizedStringFromDate:date dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle];
|
||||
_dateFormatter.dateStyle = NSDateFormatterShortStyle;
|
||||
_dateFormatter.timeStyle = NSDateFormatterShortStyle;
|
||||
return [_dateFormatter stringFromDate:date];
|
||||
}
|
||||
|
||||
-(void)setModeToDatePicker:(UIDatePicker *)datePicker
|
||||
@@ -228,6 +236,11 @@
|
||||
return _datePicker;
|
||||
}
|
||||
|
||||
-(void)setLocale:(NSLocale *)locale
|
||||
{
|
||||
_locale = locale;
|
||||
_dateFormatter.locale = locale;
|
||||
}
|
||||
|
||||
#pragma mark - Target Action
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
@interface XLFormImageCell() <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
|
||||
{
|
||||
UIPopoverController *popoverController;
|
||||
UIImagePickerController *imagePickerController;
|
||||
UIAlertController *alertController;
|
||||
}
|
||||
@@ -113,16 +112,15 @@
|
||||
imagePickerController.sourceType = source;
|
||||
|
||||
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
||||
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];
|
||||
imagePickerController.modalPresentationStyle = UIModalPresentationPopover;
|
||||
imagePickerController.popoverPresentationController.sourceRect = self.contentView.frame;
|
||||
imagePickerController.popoverPresentationController.sourceView = self.formViewController.view;
|
||||
imagePickerController.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
|
||||
}
|
||||
|
||||
[self.formViewController presentViewController: imagePickerController
|
||||
animated: YES
|
||||
completion: nil];
|
||||
}
|
||||
|
||||
#pragma mark - UIImagePickerControllerDelegate
|
||||
@@ -138,8 +136,8 @@
|
||||
}
|
||||
|
||||
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
||||
if (popoverController && popoverController.isPopoverVisible) {
|
||||
[popoverController dismissPopoverAnimated: YES];
|
||||
if (self.formViewController.presentedViewController && self.formViewController.presentedViewController.modalPresentationStyle == UIModalPresentationPopover) {
|
||||
[self.formViewController dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
} else {
|
||||
[self.formViewController dismissViewControllerAnimated: YES completion: nil];
|
||||
|
||||
@@ -28,11 +28,6 @@
|
||||
#import "NSObject+XLFormAdditions.h"
|
||||
#import "XLFormLeftRightSelectorCell.h"
|
||||
|
||||
@interface XLFormLeftRightSelectorCell() <UIActionSheetDelegate>
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation XLFormLeftRightSelectorCell
|
||||
{
|
||||
UITextField * _constraintTextField;
|
||||
@@ -195,76 +190,24 @@
|
||||
|
||||
-(void)leftButtonPressed:(UIButton *)leftButton
|
||||
{
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
|
||||
delegate:self cancelButtonTitle:nil
|
||||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
|
||||
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) {
|
||||
[actionSheet addButtonWithTitle:[leftOption.leftValue displayText]];
|
||||
[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];
|
||||
}]];
|
||||
}
|
||||
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
|
||||
|
||||
[self.formViewController presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
@@ -29,10 +29,9 @@
|
||||
#import "XLFormSelectorCell.h"
|
||||
#import "NSArray+XLFormAdditions.h"
|
||||
|
||||
@interface XLFormSelectorCell() <UIActionSheetDelegate, UIPickerViewDelegate, UIPickerViewDataSource, UIPopoverControllerDelegate>
|
||||
@interface XLFormSelectorCell() <UIPickerViewDelegate, UIPickerViewDataSource, UIPopoverPresentationControllerDelegate>
|
||||
|
||||
@property (nonatomic) UIPickerView * pickerView;
|
||||
@property (nonatomic) UIPopoverController *popoverController;
|
||||
|
||||
@end
|
||||
|
||||
@@ -87,7 +86,7 @@
|
||||
return tranformedValue;
|
||||
}
|
||||
}
|
||||
return [self.rowDescriptor.value displayText];
|
||||
return self.rowDescriptor.displayTextValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,21 +167,28 @@
|
||||
selectorViewController.title = self.rowDescriptor.selectorTitle;
|
||||
|
||||
if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorPopover]) {
|
||||
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;
|
||||
UIViewController *popoverController = self.formViewController.presentedViewController;
|
||||
if (popoverController && popoverController.modalPresentationStyle == UIModalPresentationPopover) {
|
||||
[self.formViewController dismissViewControllerAnimated:NO completion:nil];
|
||||
}
|
||||
selectorViewController.modalPresentationStyle = UIModalPresentationPopover;
|
||||
|
||||
selectorViewController.popoverPresentationController.delegate = self;
|
||||
if (self.detailTextLabel.window){
|
||||
[self.popoverController presentPopoverFromRect:CGRectMake(0, 0, self.detailTextLabel.frame.size.width, self.detailTextLabel.frame.size.height) inView:self.detailTextLabel permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
|
||||
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;
|
||||
}
|
||||
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];
|
||||
|
||||
[self.formViewController presentViewController:selectorViewController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
[controller.tableView deselectRowAtIndexPath:[controller.tableView indexPathForCell:self]
|
||||
animated:YES];
|
||||
}
|
||||
else {
|
||||
[controller.navigationController pushViewController:selectorViewController animated:YES];
|
||||
@@ -194,16 +200,24 @@
|
||||
optionsViewController.title = self.rowDescriptor.selectorTitle;
|
||||
|
||||
if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorPopover]) {
|
||||
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:optionsViewController];
|
||||
self.popoverController.delegate = self;
|
||||
optionsViewController.popoverController = self.popoverController;
|
||||
optionsViewController.modalPresentationStyle = UIModalPresentationPopover;
|
||||
|
||||
optionsViewController.popoverPresentationController.delegate = self;
|
||||
if (self.detailTextLabel.window){
|
||||
[self.popoverController presentPopoverFromRect:CGRectMake(0, 0, self.detailTextLabel.frame.size.width, self.detailTextLabel.frame.size.height) inView:self.detailTextLabel permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
|
||||
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;
|
||||
}
|
||||
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];
|
||||
|
||||
[self.formViewController presentViewController:optionsViewController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
[controller.tableView deselectRowAtIndexPath:[controller.tableView indexPathForCell:self]
|
||||
animated:YES];
|
||||
} else {
|
||||
[controller.navigationController pushViewController:optionsViewController animated:YES];
|
||||
}
|
||||
@@ -223,135 +237,76 @@
|
||||
optionsViewController.title = self.rowDescriptor.selectorTitle;
|
||||
|
||||
if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeMultipleSelectorPopover]) {
|
||||
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:optionsViewController];
|
||||
self.popoverController.delegate = self;
|
||||
optionsViewController.popoverController = self.popoverController;
|
||||
optionsViewController.modalPresentationStyle = UIModalPresentationPopover;
|
||||
|
||||
optionsViewController.popoverPresentationController.delegate = self;
|
||||
if (self.detailTextLabel.window){
|
||||
[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];
|
||||
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.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]){
|
||||
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
|
||||
delegate:self
|
||||
cancelButtonTitle:nil
|
||||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
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) {
|
||||
[actionSheet addButtonWithTitle:[option displayText]];
|
||||
}
|
||||
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];
|
||||
}]];
|
||||
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;
|
||||
}
|
||||
}
|
||||
[formViewController presentViewController:alertController animated:YES completion:nil];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:optionTitle
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[weakSelf.rowDescriptor setValue:option];
|
||||
[formViewController.tableView reloadData];
|
||||
}]];
|
||||
}
|
||||
#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
|
||||
[formViewController presentViewController:alertController animated:YES completion:nil];
|
||||
[controller.tableView deselectRowAtIndexPath:[controller.form indexPathOfFormRow:self.rowDescriptor] animated:YES];
|
||||
}
|
||||
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorAlertView]){
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:self.rowDescriptor.selectorTitle
|
||||
message:nil
|
||||
delegate:self
|
||||
cancelButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:self.rowDescriptor.selectorTitle
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
__weak __typeof(self)weakSelf = self;
|
||||
for (id option in self.rowDescriptor.selectorOptions) {
|
||||
[alertView addButtonWithTitle:[option displayText]];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:[option displayText]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[weakSelf.rowDescriptor setValue:option];
|
||||
[weakSelf.formViewController.tableView reloadData];
|
||||
}]];
|
||||
}
|
||||
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
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil]];
|
||||
[controller presentViewController:alertController animated:YES completion:nil];
|
||||
[controller.tableView deselectRowAtIndexPath:[controller.form indexPathOfFormRow:self.rowDescriptor] animated:YES];
|
||||
}
|
||||
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorPickerView]){
|
||||
@@ -372,47 +327,6 @@
|
||||
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
|
||||
@@ -449,6 +363,11 @@
|
||||
return self.rowDescriptor.selectorOptions.count;
|
||||
}
|
||||
|
||||
#pragma mark - UIPopoverPresentationControllerDelegate
|
||||
|
||||
- (void)popoverPresentationControllerDidDismissPopover:(UIPopoverPresentationController *)popoverPresentationController {
|
||||
[self.formViewController.tableView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - Helpers
|
||||
|
||||
@@ -493,12 +412,4 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UIPopoverControllerDelegate
|
||||
|
||||
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
|
||||
{
|
||||
[self.formViewController.tableView reloadData];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
|
||||
@interface XLFormOptionsObject : NSObject <XLFormOptionObject,NSCoding>
|
||||
|
||||
@property (nonatomic) NSString * formDisplaytext;
|
||||
@property (nonatomic) id formValue;
|
||||
|
||||
+(XLFormOptionsObject *)formOptionsObjectWithValue:(id)value displayText:(NSString *)displayText;
|
||||
+(XLFormOptionsObject *)formOptionsOptionForValue:(id)value fromOptions:(NSArray *)options;
|
||||
+(XLFormOptionsObject *)formOptionsOptionForDisplayText:(NSString *)displayText fromOptions:(NSArray *)options;
|
||||
|
||||
@@ -26,10 +26,6 @@
|
||||
#import "XLFormOptionsObject.h"
|
||||
|
||||
@implementation XLFormOptionsObject
|
||||
{
|
||||
NSString * _formDisplaytext;
|
||||
id _formValue;
|
||||
}
|
||||
|
||||
+(XLFormOptionsObject *)formOptionsObjectWithValue:(id)value displayText:(NSString *)displayText
|
||||
{
|
||||
@@ -85,6 +81,7 @@
|
||||
{
|
||||
return _formValue;
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding
|
||||
-(void)encodeWithCoder:(NSCoder *)encoder
|
||||
{
|
||||
@@ -94,6 +91,7 @@
|
||||
[encoder encodeObject:self.formDisplayText
|
||||
forKey:@"formDisplayText"];
|
||||
}
|
||||
|
||||
-(instancetype)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
if ((self=[super init])) {
|
||||
@@ -108,4 +106,5 @@
|
||||
return self;
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#import "XLFormRowDescriptorViewController.h"
|
||||
#import "XLFormRowDescriptor.h"
|
||||
|
||||
@interface XLFormOptionsViewController : UITableViewController<XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController>
|
||||
@interface XLFormOptionsViewController : UITableViewController<XLFormRowDescriptorViewController>
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewStyle)style;
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
@synthesize titleHeaderSection = _titleHeaderSection;
|
||||
@synthesize titleFooterSection = _titleFooterSection;
|
||||
@synthesize rowDescriptor = _rowDescriptor;
|
||||
@synthesize popoverController = __popoverController;
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewStyle)style
|
||||
{
|
||||
@@ -153,9 +152,8 @@
|
||||
self.rowDescriptor.value = cellObject;
|
||||
cell.accessoryType = UITableViewCellAccessoryCheckmark;
|
||||
}
|
||||
if (self.popoverController){
|
||||
[self.popoverController dismissPopoverAnimated:YES];
|
||||
[self.popoverController.delegate popoverControllerDidDismissPopover:self.popoverController];
|
||||
if (self.modalPresentationStyle == UIModalPresentationPopover){
|
||||
[[self presentingViewController] dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
else if ([self.parentViewController isKindOfClass:[UINavigationController class]]){
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
|
||||
@@ -32,12 +32,4 @@
|
||||
@required
|
||||
@property (nonatomic) XLFormRowDescriptor * rowDescriptor;
|
||||
|
||||
@end
|
||||
|
||||
@protocol XLFormRowDescriptorPopoverViewController <NSObject>
|
||||
|
||||
@required
|
||||
@property (nonatomic) UIPopoverController * popoverController;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -60,6 +60,7 @@ typedef NS_ENUM(NSUInteger, XLFormRowNavigationDirection) {
|
||||
|
||||
-(NSArray *)formValidationErrors;
|
||||
-(void)showFormValidationError:(NSError *)error;
|
||||
-(void)showFormValidationError:(NSError *)error withTitle:(NSString*)title;
|
||||
|
||||
-(UITableViewRowAnimation)insertRowAnimationForRow:(XLFormRowDescriptor *)formRow;
|
||||
-(UITableViewRowAnimation)deleteRowAnimationForRow:(XLFormRowDescriptor *)formRow;
|
||||
@@ -78,7 +79,7 @@ typedef NS_ENUM(NSUInteger, XLFormRowNavigationDirection) {
|
||||
|
||||
@end
|
||||
|
||||
@interface XLFormViewController : UIViewController<UITableViewDataSource, UITableViewDelegate, XLFormDescriptorDelegate, UITextFieldDelegate, UITextViewDelegate, UIActionSheetDelegate, XLFormViewControllerDelegate>
|
||||
@interface XLFormViewController : UIViewController<UITableViewDataSource, UITableViewDelegate, XLFormDescriptorDelegate, UITextFieldDelegate, UITextViewDelegate, XLFormViewControllerDelegate>
|
||||
|
||||
@property XLFormDescriptor * form;
|
||||
@property IBOutlet UITableView * tableView;
|
||||
|
||||
@@ -462,34 +462,24 @@
|
||||
|
||||
-(void)showFormValidationError:(NSError *)error
|
||||
{
|
||||
#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
|
||||
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];
|
||||
}
|
||||
|
||||
-(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];
|
||||
}
|
||||
|
||||
-(void)performFormSelector:(SEL)selector withObject:(id)sender
|
||||
|
||||
@@ -69,5 +69,6 @@ typedef NS_ENUM(NSUInteger, XLFormSectionInsertMode) {
|
||||
-(void)addFormRow:(nonnull XLFormRowDescriptor *)formRow beforeRow:(nonnull XLFormRowDescriptor *)beforeRow;
|
||||
-(void)removeFormRowAtIndex:(NSUInteger)index;
|
||||
-(void)removeFormRow:(nonnull XLFormRowDescriptor *)formRow;
|
||||
-(void)moveRowAtIndexPath:(nonnull NSIndexPath *)sourceIndex toIndexPath:(nonnull NSIndexPath *)destinationIndex;
|
||||
|
||||
@end
|
||||
|
||||
@@ -125,7 +125,15 @@
|
||||
|
||||
-(void)addFormRow:(XLFormRowDescriptor *)formRow
|
||||
{
|
||||
[self insertObject:formRow inAllRowsAtIndex:([self canInsertUsingButton] ? MAX(0, [self.formRows count] - 1) : [self.allRows count])];
|
||||
NSUInteger index;
|
||||
|
||||
if ([self canInsertUsingButton]) {
|
||||
index = ([self.formRows count] > 0) ? [self.formRows count] - 1 : 0;
|
||||
} else {
|
||||
index = [self.allRows count];
|
||||
}
|
||||
|
||||
[self insertObject:formRow inAllRowsAtIndex:index];
|
||||
}
|
||||
|
||||
-(void)addFormRow:(XLFormRowDescriptor *)formRow afterRow:(XLFormRowDescriptor *)afterRow
|
||||
|
||||
Reference in New Issue
Block a user