我已经为委托方法创建了类别UIAlertView
并覆盖了委托方法willPresentAlertView
,但我在类别中的方法没有被触发。
示例代码:
@interface UIAlertView (CustomAlert)
@end
@implementation UIAlertView (CustomAlert)
- (void)willPresentAlertView:(UIAlertView *)alertView1
{
for (UIView *sub in [alertView1 subviews])
{
if([sub class] == [UIImageView class])
{
((UIImageView *)sub).image=nil;
((UIImageView *)sub).backgroundColor = [UIColor blackColor];
}
}
[alertView1.layer setBorderColor:[[UIColor whiteColor] CGColor]];
[alertView1.layer setCornerRadius:0];
[alertView1.layer setBorderWidth:2];
}
@end