首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用UIAppearance方法定制UIAlertView

使用UIAppearance方法定制UIAlertView
EN

Stack Overflow用户
提问于 2012-12-18 15:49:12
回答 3查看 3.1K关注 0票数 3

我知道UIAlertView符合UIAppearanceUIAppearanceContainer

但是如何使用UIAppearance来定制/设计UIAlertView呢?我在网上找不到它。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2012-12-18 15:52:46

您不能使用UIAppearance自定义UIAlertView

UIAlertView仅显示为具有UIAppearance,因为UIView符合UIAppearance,而UIAlertViewUIView的子类。

但它实际上并没有实现它。

票数 11
EN

Stack Overflow用户

发布于 2012-12-18 16:43:16

如果你想使用UIAlertView功能,模式视图等...您可以将其子类化。

下面是一个示例:http://www.albertopasca.it/whiletrue/2012/07/objective-c-modal-view-navigation-tabbar-controller-projects/

希望这能有所帮助。

票数 0
EN

Stack Overflow用户

发布于 2012-12-20 18:20:51

如果你想定制UIAlertView,我做了UIAlertView的子类,你可以在github WCAlertView上找到它,它支持类似于UIAppearance的代理。您可以使用它为所有WCAlertView设置默认外观:

代码语言:javascript
复制
[WCAlertView setDefaultCustomiaztonBlock:^(WCAlertView *alertView) {
        alertView.labelTextColor = [UIColor colorWithRed:0.11f green:0.08f blue:0.39f alpha:1.00f];
        alertView.labelShadowColor = [UIColor whiteColor];

        UIColor *topGradient = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f];
        UIColor *middleGradient = [UIColor colorWithRed:0.93f green:0.94f blue:0.96f alpha:1.0f];
        UIColor *bottomGradient = [UIColor colorWithRed:0.89f green:0.89f blue:0.92f alpha:1.00f];
        alertView.gradientColors = @[topGradient,middleGradient,bottomGradient];

        alertView.outerFrameColor = [UIColor colorWithRed:250.0f/255.0f green:250.0f/255.0f blue:250.0f/255.0f alpha:1.0f];

        alertView.buttonTextColor = [UIColor colorWithRed:0.11f green:0.08f blue:0.39f alpha:1.00f];
        alertView.buttonShadowColor = [UIColor whiteColor];
}];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13928525

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档