Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.

Commit 9465dc1

Browse files
author
Ignacio Romero Zurbuchen
committed
It's better to call layout if needed in viewWillAppear: so we can force laying out a bit later. This helps preventing some layout issues when opening the view again.
1 parent 81c0818 commit 9465dc1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Source/SLKTextViewController.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,6 @@ - (void)viewDidLoad
184184
[self.view addSubview:self.textInputbar];
185185

186186
[self slk_setupViewConstraints];
187-
188-
// Forces laying out the recently added subviews and update their constraints
189-
[self.view layoutIfNeeded];
190187
}
191188

192189
- (void)viewWillAppear:(BOOL)animated
@@ -196,6 +193,9 @@ - (void)viewWillAppear:(BOOL)animated
196193
// Invalidates this flag when the view appears
197194
self.textView.didNotResignFirstResponder = NO;
198195

196+
// Forces laying out the recently added subviews and update their constraints
197+
[self.view layoutIfNeeded];
198+
199199
[UIView performWithoutAnimation:^{
200200
// Reloads any cached text
201201
[self slk_reloadTextView];

0 commit comments

Comments
 (0)