tatusBarStyleBlackTranslucent在此设

tatusBarStyleBlackTranslucent在此设

我有一个用于iPad的UIActionSheet,它具有三个选项:

  • 取消
  • 相机
  • 图片库

  • 触摸“照片库”选项时,出现崩溃和消息



    我读了this post,但没有弄清楚。

    有人能帮我吗?

    更新:
    -(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];
    }
    }
    

    我在最后一行即[self presentModalViewController:imgController animated:YES];中崩溃

    最佳答案

    对于iPad,建议您使用弹出框显示MediaBrowser(相机/照片库):

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

    您还可以设置弹出窗口的内容 View :
    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];
    

    关于ios - UIStatusBarStyleBlackTranslucent在此设备上不可用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9971081/

    10-12 02:05