I just read the iOS Human Interface Guidelines. In the chapter about Alerts, Action Sheets, and Modal Views (see here), I found this line :
The background appearance of an alert
is system-defined and cannot be
changed.
In my app I created my own UICustomAlert, inheriting from the UIAlertView class, whith following methods :
- (id)initWithImage:(UIImage *)image andButton:(UIButton *)button
{
if (self == [super init])
{
self.backgroundImage = image;
self.bigButton = button;
}
return self;
}
- (void)drawRect:(CGRect)rect
{
CGSize imageSize = self.backgroundImage.size;
[self.backgroundImage drawInRect:CGRectMake(0, 0, imageSize.width, imageSize.height)];
[self addSubview:bigButton];
}
- (void) show
{
[super show];
CGSize imageSize = self.backgroundImage.size;
self.bounds = CGRectMake(0, 0, imageSize.width, imageSize.height);
}
- (void)didAddSubview:(UIView *)subview
{
if ([subview isMemberOfClass:[UIImageView class]])
[subview removeFromSuperview];
}
I create my UICustomAlert this way :
UIAlertView *alert = [[UICustomAlert alloc] initWithImage:backgroundImage andButton:bigButton];
[alert show];
It permits me to show a UIAlert with a transparent background, and only one image (the backgroundImage).
But knowing what is written in iOS HIG, do you think Apple will reject the app ?
Thanks.
My gut feeling is that you’re probably safe. There’s nothing stopping you from implementing something like that from scratch. However I have had an app rejected for not following the HIG (they didn’t like the way I worded an error message), so they are more than just “guidelines”.