Smoother becomeFirstResponder animation
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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Smoother becomeFirstResponder animation
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 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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Smoother becomeFirstResponder animation
I am having better luck with viewWillAppear and viewWillDisappear on the device proper as opposed to the simulator. It seems to work reasonably well for what I want. On Sun, Apr 3, 2016 at 9:53 AM, Luther Baker 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 > 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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Smoother becomeFirstResponder animation
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 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 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 (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com > > This email sent to z...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Smoother becomeFirstResponder animation
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 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 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 > 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 (Cocoa-dev@lists.apple.com) > > > > 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: > > https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com > > > > This email sent to z...@mac.com > > _
Re: Smoother becomeFirstResponder animation
On Apr 3, 2016, at 11:27 PM, Luther Baker wrote: > Disconnected, the keyboard seems to come right up. I will note that - when connected to Xcode, the first modal presentation takes forever, device or simulator. YES. This is EXACTLY the same problem I had when trying to bring up the keyboard from a UITextField in an iOS app. It turns out that I found out it is a multi year old bug after wasting 1/2 a day on it 6 months ago. It’s documented on SO somewhere and it’s somewhere in my replies on SO. Seriously, something like this is a MASSIVE time waster when you figure out the nature of the bug. It ONLY HAPPENS when you run your app on iOS from Xcode and it appears to have been present since at least iOS 5. : / Nothing line burning at least 1/2 a day to try and fix it, only to realize 1. you can’t and 2. it doesn’t matter. Yep, it’s only with the first time the keyboard comes up and can take up to 20 seconds if I remember my test results correctly. Happy to help, Luther. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com