Change UIAlertView size

会有一股神秘感。 提交于 2019-12-13 16:00:32

问题


In my cocos2d game i can't change size of uialertview, i have changed statusbarorientation to landscape, and now want to init alertview with frame, and initwithframe method does not affect the size of alertview, every time the size of alert is the same, is there any way to change it ?


回答1:


Here is what i did. Create your uialertview in your controller. then override the following class within your controller (after setting the uialertview delegate ... ie. myalertview.delegate=viewcontroller)

- (void)willPresentAlertView:(UIAlertView *)alertView {
    [alertView setFrame:CGRectMake(1, 20, 2700, 400)];
}

the frame size should change after this.




回答2:


its not possible to customized UIAlertView cause its view hierarchy is private.

its clearly mentioned here UIAlertView_Class

You can go for UIView and create it similar to UIAlertView.




回答3:


Just create UIView which looks like UIAlertView. That will solve all the problem you mentioned.




回答4:


If a alert view has any title or messages text input within its view, then just append as many new line '\n' at the end of text it automatically scale its size.

Its just a mock, but stil doable to retain the alertbox usage in you application.



来源:https://stackoverflow.com/questions/8605685/change-uialertview-size

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