Re: Xcode 8 causes scroll issue when displaying keyboard
Re: Xcode 8 causes scroll issue when displaying keyboard
- Subject: Re: Xcode 8 causes scroll issue when displaying keyboard
- From: Quincey Morris <email@hidden>
- Date: Tue, 11 Oct 2016 21:07:17 -0700
- Feedback-id: 167118m:167118agrif8a:167118sslky6jnes:SMTPCORP
On Oct 11, 2016, at 20:37 , Carl Hoefs <email@hidden> wrote:
>
> I think I may have encountered similar issues. -viewWillAppear: occurs very early in the view instantiation process, too early for certain things to execute successfully, and so it's likely that becomeFirstResponder() may not work properly or reliably from -viewWillAppear:. I solved my issues by using -viewDidAppear: or -viewDidLoad, both of which also execute on the main thread, but later in the view instantiation process.
I get what you’re saying here, and your intentions are good, but the actual words you used are too wildly off to let pass without comment:
> -viewWillAppear: occurs very early in the view instantiation process, too early for certain things to execute successfully,
“Instantiation” means “creation of an instance”. While you might reasonably relax “view instantiation process” to encompass “view nib loading process”, that’s all over with before viewWillAppear time.
> and so it's likely that becomeFirstResponder() may not work properly or reliably from -viewWillAppear:.
There’s no particular reason to think that becomeFirstResponder doesn’t work, as long as the view is in the view hierarchy, which it as at viewWillAppear time. Almost certainly (IMO), Rick’s problem is that auto-layout doesn’t run until after viewWillAppear time, so the view placement relative to the keyboard has been done with layout information that isn’t final. If that’s true, moving becomeFirstResponder to viewDidAppear will solve the problem.
> I solved my issues by using -viewDidAppear: or -viewDidLoad, both of which also execute on the main thread, but later in the view instantiation process.
viewDidLoad runs *during* the nib loading process, shortly after view instantiation, much earlier than viewWillAppear.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden