为什么UIActionSheet在呈现时是透明的?

时间:2013-10-25 15:25:13

标签: ios objective-c ios7 uiactionsheet

我的UIActionSheet在显示时是透明的。我该如何改变?这是一个问题的截图:

enter image description here

代码:

   - (IBAction)btnTakePicture_Clicked:(id)sender
{
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Select Image from..." delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Camera", @"Image Gallary", nil];
    actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
    actionSheet.alpha=0.90;
    actionSheet.tag = 1;
    [actionSheet showInView:self.view];
    UIButton *btn = (UIButton *)sender;
    intButton = btn.tag;
}

2 个答案:

答案 0 :(得分:3)

我相信导致问题的是

actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;

可能在iOS 7中,这会导致透明度。尝试删除它。

此外,您将alpha设置为0.9,这将在任何情况下都会产生一些透明度(尽管如屏幕截图所示)。如果您需要完全不透明的操作表,请同时删除

actionSheet.alpha=0.90;

答案 1 :(得分:2)

删除行:

 actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
 actionSheet.alpha=0.90;

应该做的伎俩