From 1e263c7541c5f651a8aff796a017a9be5a0c84ba Mon Sep 17 00:00:00 2001 From: Mathieu Tan Date: Tue, 3 Nov 2015 16:40:47 +0100 Subject: [PATCH] scroll to the preselected element only after the view has appeared --- quickdialog/QuickDialogController.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/quickdialog/QuickDialogController.m b/quickdialog/QuickDialogController.m index 879888d4..312c4bb6 100644 --- a/quickdialog/QuickDialogController.m +++ b/quickdialog/QuickDialogController.m @@ -120,15 +120,16 @@ - (void)viewWillAppear:(BOOL)animated { if (_root!=nil) { self.title = _root.title; self.navigationItem.title = _root.title; - if (_root.preselectedElementIndex !=nil) - [self.quickDialogTableView scrollToRowAtIndexPath:_root.preselectedElementIndex atScrollPosition:UITableViewScrollPositionTop animated:NO]; - } } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; + if (_root!=nil && _root.preselectedElementIndex !=nil) { + [self.quickDialogTableView scrollToRowAtIndexPath:_root.preselectedElementIndex atScrollPosition:UITableViewScrollPositionTop animated:NO]; + } + if (_root.showKeyboardOnAppear) { QEntryElement *elementToFocus = [_root findElementToFocusOnAfter:nil]; if (elementToFocus!=nil) {