UIAlertView keyboard overlay textview issue

回眸只為那壹抹淺笑 提交于 2020-01-06 14:48:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!