Re: Smoother becomeFirstResponder animation
Re: Smoother becomeFirstResponder animation
- Subject: Re: Smoother becomeFirstResponder animation
- From: Luther Baker <email@hidden>
- Date: Sun, 03 Apr 2016 22:27:38 -0500
Hi Alex,
I am using an iPhone. Disconnected, the keyboard seems to come right up.
I'm triggering actions to the first responder using viewWillAppear and
viewWillDisappear and they seem to look fine on the device. Specifically,
the keyboard comes up right along with the presented view controller - both
controls rise from the bottom and look close to simultaneous.
Dismissal generally looks fine as well. Keyboard seems to go away correctly
such that subsequent starts look good.
I will note that - when connected to Xcode, the first modal presentation
takes forever, device or simulator. There is something going on there that
doesn't occur when I'm on device only. I assume it has to do with debugging
... Subsequent modal presentations work seem to work normally.
Hope that helps,
-Luther
On Sun, Apr 3, 2016 at 1:32 PM, Alex Zavatone <email@hidden> wrote:
> Luther, please try this.
>
> Unplug your app from your Mac and don’t launch it from Xcode.
>
> Tell me how long it takes to display the keyboard.
>
> Also, please tell me if you are using an iPhone or an iPad.
>
> I ran into this about 6 months ago and want to see if it is the same thing.
>
> Cheers.
> Alex Zavatone
>
> On Apr 3, 2016, at 10:53 AM, Luther Baker <email@hidden> wrote:
>
> > More information
> >
> > As an experiment, if I tie the DISMISS button solely to resigning first
> > responder ... and wait some amount of time before tapping SAVE to simply
> > dismiss the view controller, the KEYBOARD pops back up while the view
> > controller is dismissing!
> >
> > There must be a problem passing becomeFirstResponder from the presented
> > view controller directly to the textfield.
> >
> > -Luther
> >
> >
> > On Sun, Apr 3, 2016 at 9:26 AM, Luther Baker <email@hidden>
> wrote:
> >
> >> I am presenting a newly instantiated modal view controller (iOS, shows
> up
> >> from the bottom) and I'd like to have one of the text fields immediately
> >> becomeFirstResponder.
> >>
> >> *Approach #1:*
> >>
> >> If I invoke this directly in the presented view controller's
> >> viewWillAppear, I see some presentation animation artifacts.
> >>
> >> *Approach #2:*
> >>
> >> If I put textField.becomeFirstResponder in viewDidAppear, it feels like
> >> the user has to wait too long to see the keyboard. In addition, if I
> >> perform a series of present, dismiss, present, dismiss, etc -- the
> keyboard
> >> stops animating and starts to just "pop" into place once the view
> >> controller has finished. Maybe it doesn't "pop" as much as it simply
> >> animates much faster on subsequent requests.
> >>
> >> I've also tried to tell the textField to become first reponder in the
> >> completion handler of the originating present view controller method ---
> >> and it behaves similar to the viewDidAppear method mentioned above.
> >>
> >> What I'd like ... is to animated the keyboard ALONGSIDE the modal
> >> presentation. Is anyone aware of an effective way to do that? For what
> it's
> >> worth, I am using a mildly custom animation and taking advantage of
> >>
> >> transitionCoordinator.animateAlongsideTransition
> >>
> >> but I'm just animating some alpha values. I don't know if we can tie
> >> keyboard animations into the transitionCoordinator. My current
> >> understanding is that we don't really have any control over the keyboard
> >> animation.
> >>
> >> As an aside, resigning responder in viewWillDisappear seems to work ok
> for
> >> now but if possible, I'd prefer to explicitly animate it alongside the
> >> modal dismissal as well. Part of me wonders if the "pop"ing into place
> as
> >> mentioned above is related to a previous, incorrectly dismissed,
> keyboard.
> >> It seems to "remember" it was recently used.
> >>
> >> *Final Approach #3:*
> >>
> >> One more point: if I put textField.becomeFirstResponder in the presented
> >> view controller's "becomeFirstResponder" method, I seem to get a
> decently
> >> smooth keyboard animation alongside the modal presentation. In
> addition, it
> >> seems that the view controller's "becomeFirstResponder" is invoked
> >> automatically so I get this for free. BUT, dismissal is completely
> messed
> >> up. The call to resign first responder in viewWillDisappear no longer
> works
> >> and the keyboard lingers around for a bit after the presented view
> >> controller goes away. This is odd - it seems as if symmetric calls are
> >> required to get a proper dismissal (viewDidAppear / viewWillDisappear)
> as
> >> opposed to (becomeFirstResponder / viewWillDisappear).
> >>
> >> Sorry for the length. Any thoughts?
> >>
> >> Thanks,
> >> -Luther
> >>
> >>
> > _______________________________________________
> >
> > 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
>
>
_______________________________________________
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