uiactionsheet的背景色 [英] background color of uiactionsheet
本文介绍了uiactionsheet的背景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试更改操作表的背景颜色,我只使用以下方法:
I try to change the background color of my actionsheet, I just use the method:
[actionSheet setBackgroundColor:[UIColor colorWithRed:30 green:30 blue:30 alpha:0.5]];
[actionSheet setBackgroundColor:[UIColor colorWithRed:30 green:30 blue:30 alpha:0.5]];
,然后将其放在willPresentActionSheet中.但是背景颜色没有变化,为什么?
and I put it in the willPresentActionSheet. But the background color don't change, why?
推荐答案
- 添加QuartzCore.framework
- 为操作表设置委托
- 为操作表设置样式:UIActionSheetStyleBlackTranslucent
- 覆盖方法willPresentActionSheet
#import "QuartzCore/QuartzCore.h"
...
yourActionSheet.delegate = self;
yourActionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
...
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
[[actionSheet layer] setBackgroundColor:[UIColor redColor].CGColor];
}
这篇关于uiactionsheet的背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文