objective-c - ios ipad横屏打开系统相册和拍照
巴扎黑
巴扎黑 2017-05-02 09:30:49
0
1
589
  • (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];
    }

    }
    }

巴扎黑
巴扎黑

全員に返信(1)
我想大声告诉你

if (ISIPAD)

リーリー

// UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
// m_pPopoverController= Popover;
// [m_pPopoverController presentPopoverFromRect:CGRectMake(0, 0, 500, 500) inView:self.view allowedArrowDirections:UIPopoverArrowDirection左のアニメーション:YES];
// imagePicker.view.transform = CGAffineTransformMakeRotation(M_PI*3/2);

リーリー
いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート