操作表自然会使背景视图稍微变灰,但它并不是很明显。我想让它变得更暗。
另外,我如何制作它以便您无法在其他地方点击?现在,如果单击操作表外部,则会使操作表消失。我希望这不会发生 - 你应该推动"取消"按钮使操作表消失。
答案 0 :(得分:1)
您可以尝试这样的事情:
@property (nonatomic, strong) UIView *shadowView;
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet
{
if (!self.shadowView)
{
self.shadowView = [[UIView alloc]initWithFrame:self.view.bounds];
self.shadowView.backgroundColor = [UIColor colorWithRed:(42.0/255.0) green:(42.0/255.0) blue:(42.0/255.0) alpha:1.0];
self.shadowView.alpha = 0.7;
[self.view addSubview:self.shadowView];
}
else
{
self.shadowView.alpha = 0.7;
}
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
self.shadowView.alpha = 0.0;
}