nealyoung / NYAlertViewController

Highly configurable iOS Alert Views with custom content views
MIT License
609 stars 107 forks source link

UITextfield covered by Keyboard #16

Open eviltofu opened 8 years ago

eviltofu commented 8 years ago

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?

JJJJJJJerk commented 8 years ago

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

vertrax commented 8 years ago

@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 commented 8 years ago

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

csacanam commented 8 years ago

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

Screenshot

the-freshlord commented 8 years ago

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

tbass134 commented 8 years ago

@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

renetik commented 5 years ago

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

renetik commented 5 years ago

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