Will Apple accept a custom UIAlert? [closed]
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this questionI 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).
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".
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论