16 Commits

Author SHA1 Message Date
Martin Barreto 1738fb8e35 update version 2015-08-17 21:36:11 -03:00
Mathias Claassen c3be940cc4 updated readme for cell configuration 2015-08-17 14:44:01 -03:00
Mathias Claassen dddbb74e95 Readme FAQ update 2015-08-17 14:01:51 -03:00
mats-claassen ef90f35a0f Merge pull request #505 from xmartlabs/fix/issue485
Fix/issue485
2015-08-14 17:51:47 -03:00
Mathias Claassen c03878e656 Merge branch 'master' into fix/issue485 2015-08-14 17:51:05 -03:00
Mathias Claassen 853254d75e Updated inline picker scrolling algorithm
closes #485
2015-08-14 17:50:30 -03:00
mats-claassen 460b116018 Merge pull request #504 from xmartlabs/fix/issue497
Fixed selector push value update bug.
2015-08-14 12:43:30 -03:00
Mathias Claassen 6a501e21fb Fixed selector push value update bug.
closes #497
2015-08-14 12:41:40 -03:00
Martin Barreto 6725d0a9b4 call setNeedsUpdateConstraints to make sure updateConstraints method is called. fix #486 2015-08-02 17:01:26 -03:00
Martin Barreto daaf720c29 fix #484 2015-08-01 21:21:59 -03:00
Martin Barreto bcd9ef118e Merge pull request #482 from Cee/master
Fix a typo
2015-08-01 17:32:34 -03:00
Cee cb9d40ba3a Fix a typo 2015-08-01 23:48:27 +08:00
Martin Barreto afcf2071ed Merge pull request #481 from xmartlabs/fix/issue465
Fix/issue465
2015-07-31 21:29:57 -03:00
Mathias Claassen 12b7012a1b Updated fix. Added CountDownTimer to inline row list 2015-07-31 12:20:02 -03:00
Mathias Claassen 8632b5bb42 Fixed issue #465 2015-07-30 10:55:02 -03:00
Martin Barreto ff2d869ee0 Merge pull request #474 from xmartlabs/feature/newpod
new pod version v3.0.1
2015-07-29 15:37:15 -03:00
9 changed files with 62 additions and 21 deletions
@@ -169,7 +169,7 @@ NSString * kAccessoryViewNotes = @"notes";
[row.cellConfigAtConfigure setObject:@"TEXT VIEW EXAMPLE" forKey:@"textView.placeholder"];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Ckeck"];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Check"];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSection];
@@ -170,7 +170,7 @@ NSString * kAccessoryViewNotes = @"notes";
[row.cellConfigAtConfigure setObject:@"TEXT VIEW EXAMPLE" forKey:@"textView.placeholder"];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Ckeck"];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Check"];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"TextView With Label Example"];
@@ -142,7 +142,7 @@ class AccessoryViewFormViewController : XLFormViewController {
row.cellConfigAtConfigure["textView.placeholder"] = "TEXT VIEW EXAMPLE"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.AccessoryViewCheck.rawValue, rowType:XLFormRowDescriptorTypeBooleanCheck, title:"Ckeck")
row = XLFormRowDescriptor(tag: Tags.AccessoryViewCheck.rawValue, rowType:XLFormRowDescriptorTypeBooleanCheck, title:"Check")
section.addFormRow(row)
section = XLFormSectionDescriptor()
+24 -7
View File
@@ -4,6 +4,7 @@ XLForm
By [XMARTLABS](http://xmartlabs.com).
[![Build Status](https://travis-ci.org/xmartlabs/XLForm.svg?branch=master)](https://travis-ci.org/xmartlabs/XLForm)
[![license](https://img.shields.io/badge/pod-3.0.2-blue.svg)](https://github.com/xmartlabs/XLForm/releases)
Purpose
--------------
@@ -934,12 +935,12 @@ Each XLFormDateCell has a `minimumDate` and a `maximumDate` property. To set a d
row.cellConfig.setObject(NSDate(), forKey: "maximumDate")
```
####How to disable the entire form (read only mode).
#### How to disable the entire form (read only mode).
`disable` XLFormDescriptor property can be used to disable the entire form. In order to make the displayed cell to take effect we should reload the visible cells ( [self.tableView reloadData] ).
Any other row added after form `disable` property is set to `YES` will reflect the disable mode automatically (no need to reload table view).
####How to hide a row or section when another rows value changes.
#### How to hide a row or section when another rows value changes.
To hide a row or section you should set its hidden property. The easiest way of doing this is by setting a NSString to it. Let's say you want a section to hide if a previous row, which is a boolean switch, is set to 1 (or YES). Then you would do something like this:
```objc
@@ -947,24 +948,37 @@ section.hidden = [NSString stringWithFormat:@"$%@ == 1", previousRow];
```
That is all!
####What do I have to do to migrate from version 2.2.0 to 3.0.0?
#### What do I have to do to migrate from version 2.2.0 to 3.0.0?
The only thing that is not compatible with older versions is that the `disabled` property of the `XLFormRowDescriptor` is an `id` now. So you just have to add `@` before the values you set to it like this:
```objc
row.disabled = @YES; // before: row.disabled = YES;
```
##### How to disable input accessory view (navigation view)
#### How to change input accessory view (navigation view)
Overriding `inputAccessoryViewForRowDescriptor:` `XLFormViewController` method.
If you want to disable it completely you can return nil. But you can also customize its whole appearance here.
```obj-c
- (UIView *)inputAccessoryViewForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor {
return nil;
- (UIView *)inputAccessoryViewForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor
{
return nil; //will hide it completely
// You can use the rowDescriptor parameter to hide/customize the accessory view for a particular rowDescriptor type.
}
```
#### How to set up a pushed view controller?
The view controller that will be pushed must conform to the `XLFormRowDescriptorViewController` protocol which consists of the following property:
```objc
@property (nonatomic) XLFormRowDescriptor * rowDescriptor;
```
This rowDescriptor refers to the selected row of the previous view controller and will be set before the transition to the new controller so that it will be accessible for example in its `viewDidLoad` method. That is where that view controller should be set up.
#### How to change the default appearance of a certain cell
The best way to do this is to extend the class of that cell and override its update and/or configure methods. To make this work you should also update the `cellClassesForRowDescriptorTypes` dictionary in your subclass of XLFormViewController by setting your custom class instead of the class of the cell you wanted to change.
Installation
--------------------------
@@ -972,7 +986,7 @@ Installation
The easiest way to use XLForm in your app is via [CocoaPods](http://cocoapods.org/ "CocoaPods").
1. Add the following line in the project's Podfile file:
`pod 'XLForm', '~> 3.0.0'`.
`pod 'XLForm', '~> 3.0'`.
2. Run the command `pod install` from the Podfile folder directory.
XLForm **has no** dependencies over other pods.
@@ -1008,6 +1022,9 @@ Requirements
Release Notes
--------------
Version 3.0.2
* Fix issue when inline pickers expand beyond table.
Version 3.0.1
* Improvements and bug fixes.
+2 -2
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'XLForm'
s.version = '3.0.1'
s.version = '3.0.2'
s.license = { :type => 'MIT' }
s.summary = 'XLForm is the most flexible and powerful iOS library to create dynamic table-view forms.'
s.description = <<-DESC
@@ -8,7 +8,7 @@ Pod::Spec.new do |s|
DESC
s.homepage = 'https://github.com/xmartlabs/XLForm'
s.authors = { 'Martin Barreto' => 'martin@xmartlabs.com' }
s.source = { :git => 'https://github.com/xmartlabs/XLForm.git', :tag => 'v3.0.1' }
s.source = { :git => 'https://github.com/xmartlabs/XLForm.git', :tag => 'v3.0.2' }
s.source_files = 'XLForm/XL/**/*.{h,m}'
s.requires_arc = true
s.ios.deployment_target = '7.0'
+1
View File
@@ -81,6 +81,7 @@
inlineCell.inlineRowDescriptor = self.rowDescriptor;
[formSection addFormRow:datePickerRowDescriptor afterRow:self.rowDescriptor];
[self.formViewController ensureRowIsVisible:datePickerRowDescriptor];
}
}
return result;
@@ -54,6 +54,7 @@
UITableViewCell<XLFormInlineRowDescriptorCell> * inlineCell = (UITableViewCell<XLFormInlineRowDescriptorCell> *)cell;
inlineCell.inlineRowDescriptor = self.rowDescriptor;
[self.rowDescriptor.sectionDescriptor addFormRow:inlineRowDescriptor afterRow:self.rowDescriptor];
[self.formViewController ensureRowIsVisible:inlineRowDescriptor];
}
return result;
}
@@ -74,6 +74,8 @@ typedef NS_ENUM(NSUInteger, XLFormRowNavigationDirection) {
-(void)beginEditing:(XLFormRowDescriptor *)rowDescriptor;
-(void)endEditing:(XLFormRowDescriptor *)rowDescriptor;
-(void)ensureRowIsVisible:(XLFormRowDescriptor *)inlineRowDescriptor;
@end
@interface XLFormViewController : UIViewController<UITableViewDataSource, UITableViewDelegate, XLFormDescriptorDelegate, UITextFieldDelegate, UITextViewDelegate, UIActionSheetDelegate, XLFormViewControllerDelegate>
+29 -9
View File
@@ -55,6 +55,7 @@
@interface XLFormViewController()
{
NSNumber *_oldBottomTableContentInset;
CGRect _keyboardFrame;
}
@property UITableViewStyle tableViewStyle;
@property (nonatomic) XLFormRowNavigationAccessoryView * navigationAccessoryView;
@@ -148,7 +149,8 @@
NSIndexPath *selected = [self.tableView indexPathForSelectedRow];
if (selected){
// Trigger a cell refresh
[self tableView:self.tableView cellForRowAtIndexPath:selected];
XLFormRowDescriptor * rowDescriptor = [self.form formRowAtIndex:selected];
[self updateFormRow:rowDescriptor];
[self.tableView selectRowAtIndexPath:selected animated:NO scrollPosition:UITableViewScrollPositionNone];
[self.tableView deselectRowAtIndexPath:selected animated:YES];
}
@@ -259,7 +261,8 @@
@{XLFormRowDescriptorTypeSelectorPickerViewInline: XLFormRowDescriptorTypePicker,
XLFormRowDescriptorTypeDateInline: XLFormRowDescriptorTypeDatePicker,
XLFormRowDescriptorTypeDateTimeInline: XLFormRowDescriptorTypeDatePicker,
XLFormRowDescriptorTypeTimeInline: XLFormRowDescriptorTypeDatePicker
XLFormRowDescriptorTypeTimeInline: XLFormRowDescriptorTypeDatePicker,
XLFormRowDescriptorTypeCountDownTimerInline: XLFormRowDescriptorTypeDatePicker
} mutableCopy];
});
return _inlineRowDescriptorTypesForRowDescriptorTypes;
@@ -439,6 +442,15 @@
}
}
-(void)ensureRowIsVisible:(XLFormRowDescriptor *)inlineRowDescriptor
{
XLFormBaseCell * inlineCell = [inlineRowDescriptor cellForFormController:self];
NSIndexPath * indexOfOutOfWindowCell = [self.form indexPathOfFormRow:inlineRowDescriptor];
if(!inlineCell.window || (self.tableView.contentOffset.y + self.tableView.frame.size.height <= inlineCell.frame.origin.y + inlineCell.frame.size.height)){
[self.tableView scrollToRowAtIndexPath:indexOfOutOfWindowCell atScrollPosition:UITableViewScrollPositionBottom animated:YES];
}
}
#pragma mark - Methods
-(NSArray *)formValidationErrors
@@ -500,12 +512,12 @@
UITableViewCell<XLFormDescriptorCell> * cell = [firstResponderView formDescriptorCell];
if (cell){
NSDictionary *keyboardInfo = [notification userInfo];
CGRect keyboardFrame = [self.tableView.window convertRect:[keyboardInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue] toView:self.tableView.superview];
CGFloat newBottomInset = self.tableView.frame.origin.y + self.tableView.frame.size.height - keyboardFrame.origin.y;
if (newBottomInset > 0){
UIEdgeInsets tableContentInset = self.tableView.contentInset;
UIEdgeInsets tableScrollIndicatorInsets = self.tableView.scrollIndicatorInsets;
_oldBottomTableContentInset = _oldBottomTableContentInset ? : @(tableContentInset.bottom);
_keyboardFrame = [self.tableView.window convertRect:[keyboardInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue] toView:self.tableView.superview];
CGFloat newBottomInset = self.tableView.frame.origin.y + self.tableView.frame.size.height - _keyboardFrame.origin.y;
UIEdgeInsets tableContentInset = self.tableView.contentInset;
UIEdgeInsets tableScrollIndicatorInsets = self.tableView.scrollIndicatorInsets;
_oldBottomTableContentInset = _oldBottomTableContentInset ?: @(tableContentInset.bottom);
if (newBottomInset > [_oldBottomTableContentInset floatValue]){
tableContentInset.bottom = newBottomInset;
tableScrollIndicatorInsets.bottom = tableContentInset.bottom;
[UIView beginAnimations:nil context:nil];
@@ -525,6 +537,7 @@
UIView * firstResponderView = [self.tableView findFirstResponder];
UITableViewCell<XLFormDescriptorCell> * cell = [firstResponderView formDescriptorCell];
if (cell){
_keyboardFrame = CGRectZero;
NSDictionary *keyboardInfo = [notification userInfo];
UIEdgeInsets tableContentInset = self.tableView.contentInset;
UIEdgeInsets tableScrollIndicatorInsets = self.tableView.scrollIndicatorInsets;
@@ -562,6 +575,7 @@
{
XLFormBaseCell * cell = [formRow cellForFormController:self];
cell.rowDescriptor = formRow;
[cell setNeedsUpdateConstraints];
[cell setNeedsLayout];
return cell;
}
@@ -585,7 +599,13 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
XLFormRowDescriptor * rowDescriptor = [self.form formRowAtIndex:indexPath];
return [self updateFormRow:rowDescriptor];
return [rowDescriptor cellForFormController:self];
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
XLFormRowDescriptor * rowDescriptor = [self.form formRowAtIndex:indexPath];
[self updateFormRow:rowDescriptor];
}