问题
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