• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Smoother becomeFirstResponder animation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Smoother becomeFirstResponder animation


  • Subject: Re: Smoother becomeFirstResponder animation
  • From: Luther Baker <email@hidden>
  • Date: Sun, 03 Apr 2016 10:03:53 -0500

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 <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


References: 
 >Smoother becomeFirstResponder animation (From: Luther Baker <email@hidden>)
 >Re: Smoother becomeFirstResponder animation (From: Luther Baker <email@hidden>)

  • Prev by Date: Re: Smoother becomeFirstResponder animation
  • Next by Date: Re: Smoother becomeFirstResponder animation
  • Previous by thread: Re: Smoother becomeFirstResponder animation
  • Next by thread: Re: Smoother becomeFirstResponder animation
  • Index(es):
    • Date
    • Thread