NYAlertViewController icon indicating copy to clipboard operation
NYAlertViewController copied to clipboard

UITextfield covered by Keyboard

Open eviltofu opened this issue 10 years ago • 8 comments

When the message is long,and there is a UITextField under it, the UITextField is covered by the keyboard. Is there a way to shift the UITextField to uncover it?

eviltofu avatar Jan 08 '16 09:01 eviltofu

NYAlertView line 295 _backgroundViewVerticalCenteringConstraint set this constant to be -55.

NYAlertView *view = (NYAlertView *)alertViewController.view;
view.backgroundViewVerticalCenteringConstraint.constant = -55.f;

+@property (nonatomic, readonly) NSLayoutConstraint *backgroundViewVerticalCenteringConstraint; still you can set the constraint.constant value

JJJJJJJerk avatar Mar 22 '16 02:03 JJJJJJJerk

@JJJJJJJerk Im sorry I don't understand your answer, can you please elaborate? Would this make the view controller scroll up as the keyboard is shown? Or what?

vertrax avatar Mar 29 '16 22:03 vertrax

@JJJJJJJerk Your code doesn't even work, I can't import NYAlertView from pods.

vertrax avatar Mar 30 '16 21:03 vertrax

Same issue here. I don't event know how to set the "intro button" event to hide the keyboard

Screenshot

csacanam avatar Apr 20 '16 16:04 csacanam

This does work for me. Did you do import "NYAlertView.h"?

the-freshlord avatar Aug 23 '16 19:08 the-freshlord

@JJJJJJJerk has the right idea. by getting access to the NYAlertAction's backgroundViewVerticalCenteringConstraint, you can move up the textField to a certain extent.

let alert:NYAlertViewController = NYAlertViewController(nibName: nil, bundle: nil) alert.title = "title alert.message = "message" let alertView = alert.view as! NYAlertView alertView.backgroundViewVerticalCenteringConstraint.constant = -55

although its not the best solution. but it gets the job done for me

tbass134 avatar Oct 31 '16 20:10 tbass134

Well this is really crappy solution, should be stated in main page to alert users that this crucial func is not implemented

renetik avatar Sep 22 '19 12:09 renetik

Barely usable , you turn landscape and what ... This lib is not ready for production

renetik avatar Sep 22 '19 12:09 renetik