问题
I have found this code:
CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0);
[myAlertView setTransform:myTransform];
But seems it want move up my alert to the top. How can I move up alert view to the top?
Set frame does not help as well. alerView.frame = rect;
回答1:
You can't, if you're using a UIAlertView
. From the apple docs:
Appearance of Alert Views
You cannot customize the appearance of alert views.
else where....
Subclassing Notes
The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.
and further..
Using Auto Layout with Alert Views
The layout of alert views is handled for you. You cannot create Auto Layout constraints between an alert view and another user interface element.
See Apple Docs and Alert Views
UIAlertView
is also deprecated as of iOS8, so you should use UIAlertController
instead. Or you could just make a custom UIView
that does what you need it to do.
来源:https://stackoverflow.com/questions/28224859/uialertview-keyboard-overlay-textview-issue