我通过以下代码在UIAlertView的UIImageView中提供了一个accessoryView:
UIAlertView *alertView = [[UIAlertView alloc]init];
[alertView addButtonWithTitle:@"Cancel"];
[alertView addButtonWithTitle:@"OK"];
UIImageView *someImageView = /*initialization code */;
[someImageView setFrame:CGRectMake(0,0,40 ,20)];
[alertView someImageView forKey:@"accessoryView"];
[alertView show];上面的代码在iOS7中工作得很好,但是由于对iOS8的更新,alertView看起来是拉长的和方向不明的。我尝试更改UIImageView中设置的图像的约束和高宽比。有人能帮我吗?
发布于 2014-09-19 14:06:29
这不是对UIAlertView的支持使用。
UIAlertView类打算以原样形式使用,而不支持子类化。此类的视图层次结构是私有的,不能修改。
此外,在UIAlertView 8中不推荐使用UIAlertView。
您应该构建自己的视图,以便在GitHub/CocoaControls上显示或使用许多开源选项之一,如SDCAlertView或ios-自定义-警报视图。
https://stackoverflow.com/questions/25935561
复制相似问题