ios ipad横屏打开系统相册和拍照

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

    if (buttonIndex == 0) {

    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
        UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
        imagePicker.delegate = self;
        imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
        imagePicker.videoQuality = UIImagePickerControllerQualityTypeHigh;
        imagePicker.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        imagePicker.allowsEditing = YES;
        imagePicker.view.transform  =   CGAffineTransformMakeRotation(M_PI*3/2);
        
        if (ISIPAD)
        {
            [self presentModalViewController:imagePicker animated:YES];
        }else if (ISIPHONE)
        {
            [self presentViewController:imagePicker animated:YES completion:nil];
        }
    }
    

    } else if (buttonIndex == 1) {

    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.delegate = self;
    imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    imagePicker.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    imagePicker.allowsEditing = YES;
    imagePicker.view.transform  =   CGAffineTransformMakeRotation(M_PI*3/2);
    if (ISIPAD)
    {
        
        [[NSOperationQueue mainQueue] addOperationWithBlock:^{
            
            UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
            m_pPopoverController= popover;
            [m_pPopoverController presentPopoverFromRect:CGRectMake(0, 0, 600, 800) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
          
        }];
    
        
    }else if (ISIPHONE)
    {
        [self presentViewController:imagePicker animated:YES completion:nil];
    }

    }
    }

阅读 4.2k
1 个回答

if (ISIPAD)

    {
        
        [[NSOperationQueue mainQueue] addOperationWithBlock:^{
            

// UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
// m_pPopoverController= popover;
// [m_pPopoverController presentPopoverFromRect:CGRectMake(0, 0, 500, 500) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
// imagePicker.view.transform = CGAffineTransformMakeRotation(M_PI*3/2);

            [self presentViewController:imagePicker animated:YES completion:nil];

        }];

        
    }else if (ISIPHONE)
    {
        [self presentViewController:imagePicker animated:YES completion:nil];
    }
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进