user2588945
user2588945

Reputation: 1681

Why is UIActionSheet transparent when presented?

My UIActionSheet is transparent when it displays. How do I change this? here's a screenshot of what the problem looks like:

enter image description here

the code:

   - (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;
}

Upvotes: 3

Views: 2028

Answers (2)

RyanG
RyanG

Reputation: 4503

Removing the lines:

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

Should do the trick

Upvotes: 2

Gabriele Petronella
Gabriele Petronella

Reputation: 108101

I believe what's causing problems is

actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;

Probably in iOS 7 this causes the transparency. Try removing it.

Also you are setting the alpha to 0.9, which will cause some transparency in any case (not as showed in the screenshot though). If you want a completely opaque action sheet, remove also

actionSheet.alpha=0.90;

Upvotes: 3

Related Questions