UIAlertView奇怪的angular落显示

我在UIAlertView中有一个UITableView,现在它显示了一些非常丑陋的angular落。 我在willPresentAlertView()中放大了alertview的大小。

#define ALERT_VIEW_WIDTH 750 #define ALERT_PADDING 20 - (void)willPresentAlertView:(UIAlertView *)alertView { { NSLog(@"%@", [[alertView class] description]); id thing; if ( [[[alertView class] description] isEqualToString:@"UIAlertTableView"]){ //change the alert view size NSLog(@"center: %f", alertView.center.x); int center=alertView.center.x-ALERT_VIEW_WIDTH/2; for (thing in alertView.subviews) { NSLog(@"%@", [[thing class] description]); if([[[thing class] description] isEqualToString:@"UITableView"]) { UIView* v=(UIView*)thing; v.frame=CGRectMake(v.frame.origin.x+ALERT_PADDING, v.frame.origin.y, ALERT_VIEW_WIDTH-ALERT_PADDING*3, 250); } if([[[thing class] description] isEqualToString:@"UIAlertButton"]) { //UIView* v=(UIView*)thing; //v.frame=CGRectMake(v.center.x, v.frame.origin.y, 100, v.frame.size.height-10); } if([[[thing class] description] isEqualToString:@"UILabel"]) { //UIView* v=(UIView*)thing; //v.frame=CGRectMake(center-v.frame.size.width/2, v.frame.origin.y, v.frame.size.width, v.frame.size.height); } } alertView.frame=CGRectMake(center, alertView.frame.origin.y, ALERT_VIEW_WIDTH, 360); } } } 

这可以如何解决? 谢谢! 在这里输入图像说明

看起来它只是伸展自己,而不是重新绘制其内容。 您需要告诉它需要重[alertView setNeedsDisplay][alertView setNeedsDisplay] ),或者将其内容模式设置为重绘,以便帧更改触发重绘。

另外,私人视图层次结构的导航是相当脆弱的东西。 这不会在iOS上花费太多时间来改变这个神秘的停止工作。