Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIStatusBarStyleBlackTranslucent is not available on this device

I have a UIActionSheet for iPad which has three options :

  1. Cancel
  2. Camera
  3. Photo Library

When I touch the "Photo Library" option I get a crash and a message

UIStatusBarStyleBlackTranslucent is not available on this device.

I read this post, but didn't figure it out.

Can someone help me?

Update :

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

    if (buttonIndex == 0) 
    {

        imgController = [[UIImagePickerController alloc] init];
        imgController.allowsEditing = YES;
        imgController.sourceType =  UIImagePickerControllerSourceTypeCamera;   
        imgController.delegate=self;
        [self presentModalViewController:imgController animated:YES];

    } 
    else if (buttonIndex == 1) 
    {
        imgController = [[UIImagePickerController alloc] init];
        imgController.sourceType =  UIImagePickerControllerSourceTypePhotoLibrary;
        imgController.delegate=self;
        [self presentModalViewController:imgController animated:YES];  
}
}  

I get crash in last line i.e [self presentModalViewController:imgController animated:YES];

like image 494
Nitish Avatar asked Apr 02 '12 04:04

Nitish


1 Answers

For iPad it is recommended that you should use popover to present the MediaBrowser (camera / photoLibrary):

UIImagePickerController *ipc = [[UIImagePickerController alloc] init];

UIPopoverController *popOverController = [[UIPopoverController alloc] initWithContentViewController:ipc];
popOverController.delegate = self;

You can also set the content view for popover:

ipc.delegate = self; 
ipc.editing = NO;       
ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
ipc.mediaTypes =[UIImagePickerController availableMediaTypesForSourceType:ipc.sourceType];

[popOverController presentPopoverFromRect:btnGallery.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
like image 100
Zubair Avatar answered Sep 23 '22 15:09

Zubair