我知道UIAlertView符合UIAppearance和UIAppearanceContainer。
但是如何使用UIAppearance来定制/设计UIAlertView呢?我在网上找不到它。
发布于 2012-12-18 15:52:46
您不能使用UIAppearance自定义UIAlertView。
UIAlertView仅显示为具有UIAppearance,因为UIView符合UIAppearance,而UIAlertView是UIView的子类。
但它实际上并没有实现它。
发布于 2012-12-18 16:43:16
如果你想使用UIAlertView功能,模式视图等...您可以将其子类化。
下面是一个示例:http://www.albertopasca.it/whiletrue/2012/07/objective-c-modal-view-navigation-tabbar-controller-projects/
希望这能有所帮助。
发布于 2012-12-20 18:20:51
如果你想定制UIAlertView,我做了UIAlertView的子类,你可以在github WCAlertView上找到它,它支持类似于UIAppearance的代理。您可以使用它为所有WCAlertView设置默认外观:
[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];
}];https://stackoverflow.com/questions/13928525
复制相似问题