diff --git a/XLForm/XL/Cell/XLFormDateCell.m b/XLForm/XL/Cell/XLFormDateCell.m index 5821fcd7..2c055cc1 100644 --- a/XLForm/XL/Cell/XLFormDateCell.m +++ b/XLForm/XL/Cell/XLFormDateCell.m @@ -95,10 +95,10 @@ -(BOOL)resignFirstResponder NSIndexPath * selectedRowPath = [self.formViewController.form indexPathOfFormRow:self.rowDescriptor]; NSIndexPath * nextRowPath = [NSIndexPath indexPathForRow:selectedRowPath.row + 1 inSection:selectedRowPath.section]; XLFormRowDescriptor * nextFormRow = [self.formViewController.form formRowAtIndex:nextRowPath]; - BOOL result = [super resignFirstResponder]; if ([nextFormRow.rowType isEqualToString:XLFormRowDescriptorTypeDatePicker]){ [self.rowDescriptor.sectionDescriptor removeFormRow:nextFormRow]; } + BOOL result = [super resignFirstResponder]; return result; } return [super resignFirstResponder]; diff --git a/XLForm/XL/Helpers/UIView+XLFormAdditions.h b/XLForm/XL/Helpers/UIView+XLFormAdditions.h index 406f7dd2..c7b1cf14 100644 --- a/XLForm/XL/Helpers/UIView+XLFormAdditions.h +++ b/XLForm/XL/Helpers/UIView+XLFormAdditions.h @@ -32,5 +32,6 @@ -(NSLayoutConstraint *)layoutConstraintSameHeightOf:(UIView *)view; -(UIView *)findFirstResponder; -(UITableViewCell *)formDescriptorCell; +-(BOOL)isRTL; @end diff --git a/XLForm/XL/Helpers/UIView+XLFormAdditions.m b/XLForm/XL/Helpers/UIView+XLFormAdditions.m index 3113265d..6e4d02f9 100644 --- a/XLForm/XL/Helpers/UIView+XLFormAdditions.m +++ b/XLForm/XL/Helpers/UIView+XLFormAdditions.m @@ -70,4 +70,20 @@ - (UIView *)findFirstResponder return nil; } +- (BOOL)isRTL{ + BOOL isRTL = NO; + if([self respondsToSelector:@selector(effectiveUserInterfaceLayoutDirection)] && + [self effectiveUserInterfaceLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft) { + isRTL = YES; + } + else if ([[UIView class] respondsToSelector:@selector(userInterfaceLayoutDirectionForSemanticContentAttribute:)] && + [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft) { + isRTL = YES; + } + else if ([[UIApplication sharedApplication] userInterfaceLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft){ + isRTL = YES; + } + return isRTL; +} + @end diff --git a/XLForm/XL/Helpers/Views/XLFormRowNavigationAccessoryView.m b/XLForm/XL/Helpers/Views/XLFormRowNavigationAccessoryView.m index f769a5ba..46eb931c 100755 --- a/XLForm/XL/Helpers/Views/XLFormRowNavigationAccessoryView.m +++ b/XLForm/XL/Helpers/Views/XLFormRowNavigationAccessoryView.m @@ -24,7 +24,7 @@ #import "XLFormRowNavigationAccessoryView.h" - +#import "UIView+XLFormAdditions.h" @interface XLFormRowNavigationAccessoryView () @@ -45,9 +45,10 @@ - (instancetype)initWithFrame:(CGRect)frame self = [super initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 44.0)]; if (self) { self.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth); - NSArray * items = [NSArray arrayWithObjects:self.previousButton, + BOOL isRTL = [self isRTL]; + NSArray * items = [NSArray arrayWithObjects:isRTL ? self.nextButton : self.previousButton, self.fixedSpace, - self.nextButton, + isRTL ? self.previousButton : self.nextButton, self.flexibleSpace, self.doneButton, nil]; [self setItems:items];