From 725400c1ed213331328fd359dca4598c53baf572 Mon Sep 17 00:00:00 2001 From: Patrick Nollet Date: Fri, 6 Mar 2015 14:19:58 +0100 Subject: [PATCH 1/6] Workaround for UITextField bug: if the user is using a bigger system font, a long text won't scroll Steps to reproduce the bug: * Set a bigger font in Settings -> General -> Accessibility -> Larger text * Type a long text in a UITextField with adjustsFontSizeToFitWidth set to NO (as any QTextField) => Text won't scroll, we don't see anymore what's typed in. The minimum font size that I set is the biggest one that is OK --- quickdialog/QEntryTableViewCell.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/quickdialog/QEntryTableViewCell.m b/quickdialog/QEntryTableViewCell.m index 959c5b18..77f2bad1 100644 --- a/quickdialog/QEntryTableViewCell.m +++ b/quickdialog/QEntryTableViewCell.m @@ -143,6 +143,10 @@ - (void)prepareForElement:(QEntryElement *)element inTableView:(QuickDialogTable _textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; _textField.textAlignment = _entryElement.appearance.entryAlignment; + // workaround for UITextField bug: if the user is using a bigger system font, a long text won't scroll + _textField.adjustsFontSizeToFitWidth = YES; + _textField.minimumFontSize = 20.0f; + _textField.returnKeyType = _entryElement.returnKeyType; _textField.enablesReturnKeyAutomatically = _entryElement.enablesReturnKeyAutomatically; From 385078e4ebeb7175ca9813901e6afc451fcd6ae1 Mon Sep 17 00:00:00 2001 From: Patrick Nollet Date: Thu, 24 Sep 2015 12:55:52 +0200 Subject: [PATCH 2/6] Fix infinite recursion --- extras/QPickerTableViewCell.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/QPickerTableViewCell.m b/extras/QPickerTableViewCell.m index 444ee5dc..4bfc7fc5 100644 --- a/extras/QPickerTableViewCell.m +++ b/extras/QPickerTableViewCell.m @@ -19,7 +19,7 @@ @implementation QPickerTableViewCell - (QPickerTableViewCell *)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { - if ((self = [self initWithStyle:style reuseIdentifier:reuseIdentifier])) + if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) { [self createSubviews]; self.selectionStyle = UITableViewCellSelectionStyleBlue; From 69985ac16cc4994423db73291befb46a5edcc126 Mon Sep 17 00:00:00 2001 From: Patrick Nollet Date: Fri, 16 Oct 2015 10:31:20 +0200 Subject: [PATCH 3/6] Fix multiline element not refreshing --- quickdialog/QMultilineElement.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickdialog/QMultilineElement.m b/quickdialog/QMultilineElement.m index 990c4ee2..bc4e242a 100644 --- a/quickdialog/QMultilineElement.m +++ b/quickdialog/QMultilineElement.m @@ -68,7 +68,7 @@ - (void)selected:(QuickDialogTableView *)tableView controller:(QuickDialogContro __weak QMultilineTextViewController *weakTextController = textController; textController.willDisappearCallback = ^ { weakSelf.textValue = weakTextController.textView.text; - [[tableView cellForElement:weakSelf] setNeedsDisplay]; + [tableView reloadCellForElements:weakSelf, nil]; [tableView deselectRowAtIndexPath:indexPath animated:YES]; }; [controller displayViewController:textController withPresentationMode:self.presentationMode]; From 969123cdf1f9140beaddb184bdb93d6051e477a8 Mon Sep 17 00:00:00 2001 From: Patrick Nollet Date: Fri, 16 Oct 2015 11:37:43 +0200 Subject: [PATCH 4/6] Fix multiline element content inset Removes the black border at the top behind the navigation bar. The contentInset is nicely automatically set, we don't want to reset it. --- quickdialog/QMultilineTextViewController.m | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/quickdialog/QMultilineTextViewController.m b/quickdialog/QMultilineTextViewController.m index 329bb8b1..be8d5cfb 100644 --- a/quickdialog/QMultilineTextViewController.m +++ b/quickdialog/QMultilineTextViewController.m @@ -50,13 +50,6 @@ - (void)loadView self.view = _textView; } -- (void)viewDidLoad -{ - [super viewDidLoad]; - if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) - self.edgesForExtendedLayout = UIRectEdgeNone; -} - - (void)viewWillAppear:(BOOL)animated { _viewOnScreen = YES; @@ -102,7 +95,7 @@ - (void) resizeForKeyboard:(NSNotification*)aNotification { [UIView animateWithDuration:animationDuration delay:0 options:animationCurve animations:^{ CGRect keyboardFrame = [self.view convertRect:keyboardEndFrame toView:nil]; - _textView.contentInset = UIEdgeInsetsMake(0.0, 0.0, up ? keyboardFrame.size.height : 0, 0.0); + _textView.contentInset = UIEdgeInsetsMake(_textView.contentInset.top, _textView.contentInset.left, up ? keyboardFrame.size.height : 0, _textView.contentInset.right); } completion:NULL]; } From 90c8c6a0cc2c32a2e84c2309df88a43ee74ea4f0 Mon Sep 17 00:00:00 2001 From: Bruno Virlet Date: Thu, 17 Mar 2016 15:43:35 +0100 Subject: [PATCH 5/6] Fix inputAccessoryView tint color issue actionBar.tintColor is nil because the action bar is not in the view hierarchy, so this line isn't useful and is actually harmful because it overrides UIAppearance tintColor definitions. --- quickdialog/QEntryTableViewCell.m | 1 - 1 file changed, 1 deletion(-) diff --git a/quickdialog/QEntryTableViewCell.m b/quickdialog/QEntryTableViewCell.m index 959c5b18..6063a5d9 100644 --- a/quickdialog/QEntryTableViewCell.m +++ b/quickdialog/QEntryTableViewCell.m @@ -36,7 +36,6 @@ -(UIToolbar *)createActionBar { _prevNext = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:NSLocalizedString(@"Previous", @""), NSLocalizedString(@"Next", @""), nil]]; _prevNext.momentary = YES; _prevNext.segmentedControlStyle = UISegmentedControlStyleBar; - _prevNext.tintColor = actionBar.tintColor; [_prevNext addTarget:self action:@selector(handleActionBarPreviousNext:) forControlEvents:UIControlEventValueChanged]; UIBarButtonItem *prevNextWrapper = [[UIBarButtonItem alloc] initWithCustomView:_prevNext]; UIBarButtonItem *flexible = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; From d8d58172aac608ec1a821dd3560112098be3de06 Mon Sep 17 00:00:00 2001 From: Patrick Nollet Date: Tue, 18 Jul 2017 23:06:28 +0200 Subject: [PATCH 6/6] Add support for timezone in QDateTimeInlineElement --- quickdialog/QDateInlineTableViewCell.m | 3 ++- quickdialog/QDateTimeInlineElement.h | 5 +++++ quickdialog/QDateTimeInlineElement.m | 17 ++++++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/quickdialog/QDateInlineTableViewCell.m b/quickdialog/QDateInlineTableViewCell.m index e830d781..893c38af 100644 --- a/quickdialog/QDateInlineTableViewCell.m +++ b/quickdialog/QDateInlineTableViewCell.m @@ -41,7 +41,7 @@ - (void)prepareDateTimePicker:(QDateTimeInlineElement *)element if (!self.pickerView) self.pickerView = [[UIDatePicker alloc] init]; - self.pickerView.timeZone = [NSTimeZone localTimeZone]; + self.pickerView.timeZone = element.timezone; [self.pickerView sizeToFit]; self.pickerView.datePickerMode = element.mode; self.pickerView.maximumDate = element.maximumDate; @@ -68,6 +68,7 @@ - (void) dateChanged:(id)sender{ - (void)prepareForElement:(QDateTimeInlineElement *)element inTableView:(QuickDialogTableView *)tableView { NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.timeZone = element.timezone; self.element = element; if (element.customDateFormat!=nil){ diff --git a/quickdialog/QDateTimeInlineElement.h b/quickdialog/QDateTimeInlineElement.h index c787e3d3..3e315efa 100755 --- a/quickdialog/QDateTimeInlineElement.h +++ b/quickdialog/QDateTimeInlineElement.h @@ -19,6 +19,7 @@ @interface QDateTimeInlineElement : QEntryElement { NSDate * _dateValue; @private + NSTimeZone *_timezone; UIDatePickerMode _mode; NSInteger _minuteInterval; BOOL _centerLabel; @@ -29,6 +30,8 @@ @property (assign) UIDatePickerMode mode; +@property (nonatomic, strong) NSTimeZone *timezone; + @property (assign) NSInteger minuteInterval; @property(nonatomic) BOOL centerLabel; @@ -43,4 +46,6 @@ - (QDateTimeInlineElement *)initWithTitle:(NSString *)string date:(NSDate *)date andMode:(UIDatePickerMode)mode; +- (QDateTimeInlineElement *)initWithTitle:(NSString *)string date:(NSDate *)date timezone:(NSTimeZone *)timezone andMode:(UIDatePickerMode)mode; + @end diff --git a/quickdialog/QDateTimeInlineElement.m b/quickdialog/QDateTimeInlineElement.m index b608eb24..d22d16bb 100755 --- a/quickdialog/QDateTimeInlineElement.m +++ b/quickdialog/QDateTimeInlineElement.m @@ -25,6 +25,7 @@ @implementation QDateTimeInlineElement { } @synthesize mode = _mode; +@synthesize timezone = _timezone; @synthesize centerLabel = _centerLabel; @synthesize maximumDate = _maximumDate; @synthesize minimumDate = _minimumDate; @@ -46,15 +47,24 @@ - (QDateTimeInlineElement *)initWithKey:(NSString *)key { return self; } -- (QDateTimeInlineElement *)initWithTitle:(NSString *)string date:(NSDate *)date andMode:(UIDatePickerMode)mode{ +- (QDateTimeInlineElement *)initWithTitle:(NSString *)string date:(NSDate *)date timezone:(NSTimeZone *)timezone andMode:(UIDatePickerMode)mode { self = [super initWithTitle:string Value:[date description]]; if (self!=nil){ _dateValue = date; _mode = mode; + _timezone = timezone; } return self; + +} + +- (QDateTimeInlineElement *)initWithTitle:(NSString *)string date:(NSDate *)date andMode:(UIDatePickerMode)mode{ + return [self initWithTitle:string date:date timezone:nil andMode:mode]; } +- (QDateTimeInlineElement *)initWithDate:(NSDate *)date andMode:(UIDatePickerMode)mode{ + return [self initWithTitle:nil date:date andMode:mode]; +} - (void)setTicksValue:(NSNumber *)ticks { if (ticks!=nil) @@ -69,6 +79,7 @@ - (NSDate *)dateValue { if (self.mode == UIDatePickerModeDate) { NSCalendar *gregorian = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar]; + gregorian.timeZone = _timezone; NSDateComponents *dateComponents = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:_dateValue]; _dateValue = [gregorian dateFromComponents:dateComponents]; } @@ -79,10 +90,6 @@ -(NSNumber *)ticksValue { return [NSNumber numberWithDouble:[self.dateValue timeIntervalSince1970]]; } -- (QDateTimeInlineElement *)initWithDate:(NSDate *)date andMode:(UIDatePickerMode)mode{ - return [self initWithTitle:nil date:date andMode:mode]; -} - - (UITableViewCell *)getCellForTableView:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller { QTableViewCell *cell= self.showPickerInCell ? [self getInlineCell:tableView] : [self getEntryCell:tableView];