alexanderjarvis / PXAlertView

A drop-in replacement for UIAlertView that is more customisable and skinnable
MIT License
592 stars 95 forks source link

Alert view stays hidden by keyboard #21

Closed AlexanderZubkov closed 10 years ago

AlexanderZubkov commented 10 years ago

Hello. I've added a textview as a content view but when the keyboard comes up it hides half of alert view, i.e. alert view is not moving up. :( Is it possible to make it to move up? Thank you.

forgot commented 10 years ago

According to #17, this should become available when the API is updated again. From what I understand (@alexanderjarvis, please correct me if I'm wrong) , trying to do it manually would mean making several private methods and properties public, and could potentially cause massive headaches down the road when you pull in any new commits. Once we regain access to the alert views origin, you'll be able to adjust it with info from the notifications sent when the keyboard is displayed.

alexanderjarvis commented 10 years ago

To do this you will need to subclass PXAlertView.

You need to add an observer for UIKeyboardWillShowNotification which you can extract the animation curve (UIKeyboardAnimationCurveUserInfoKey) and duration (UIKeyboardAnimationDurationUserInfoKey).

Using this you can then animate repositioning the alert view by setting its frame or center.

I hope this helps.