开发者

Will Apple accept a custom UIAlert? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question does not appear to be about programming within the scope defined in the help center.

Closed 5 years ago.

Improve this question

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".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜