【发布时间】:2011-07-05 14:40:37
【问题描述】:
我刚刚阅读了 iOS 人机界面指南。在关于警报、操作表和模式视图(参见here)的章节中,我发现了这一行:
警报的背景外观 是系统定义的,不能 改变了。
在我的应用程序中,我创建了自己的 UICustomAlert,继承自 UIAlertView 类,使用以下方法:
- (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];
}
我以这种方式创建我的 UICustomAlert :
UIAlertView *alert = [[UICustomAlert alloc] initWithImage:backgroundImage andButton:bigButton];
[alert show];
它允许我显示具有透明背景的 UIAlert,并且只有一张图像(backgroundImage)。
但是知道iOS HIG写的是什么,你觉得苹果会拒绝这个应用吗?
谢谢。
【问题讨论】:
-
我建议不要使用 UICustomAlert 的类名(如果那是真正的类名),因为 UI 前缀可能会在未来某个时候与 UIKit 中的类发生冲突!
-
好的,谢谢您的提示。我会改的。
-
您提交过应用吗?批准了吗?
-
目前正在验证过程中。我让你知道。
标签: iphone objective-c appstore-approval