1

私はUIImagePickerController画像を選択するために使用しており、iPadアプリケーションで画像を使用していますが、シミュレーターでは正常にimagepickerController動作しますが、デバイスで開かれません ここに私のコードがあります

        else if([labelType.text isEqualToString:@"Select Image"]){

        selectedType=@"Select Image";

        BOOL isiPhone;

        UIImagePickerController *pckrImage = [[UIImagePickerController alloc] init];
        pckrImage.delegate = self;
        if (isiPhone) {
            if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary]) 
            {
                pckrImage.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;                  
                [self presentModalViewController:pckrImage animated:YES];
            }
            else {

            }
        }
        else
        {
            popOver = [[UIPopoverController alloc]initWithContentViewController:pckrImage];
            [popOver presentPopoverFromRect:CGRectMake(450.0f, 825.0f, 10.0f, 10.0f) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];       
        }    
}
4

3 に答える 3

0

のように変更してください。

UIImagePickerController *pckrImage = [[UIImagePickerController alloc] init];
        pckrImage.delegate = self;
        if (isiPhone) {
            if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary])



            {
                pckrImage.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;







                [self presentModalViewController:pckrImage animated:YES];
            }
            else {

            }
        }
        else
        {
            UIPopoverController *popOver = [[UIPopoverController alloc]initWithContentViewController:pckrImage];
            self.popoverImageViewController = popOver;
            [self.popoverImageViewController presentPopoverFromRect:CGRectMake(450.0f, 825.0f, 10.0f, 10.0f) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];


        }   

オブジェクトを初期化する

@property (strong,nonatomic) UIPopoverController *popoverImageViewController;
于 2013-09-12T07:34:38.380 に答える
0

これを試して:

UIImagePickerController *pckrImage = [[UIImagePickerController alloc] init];
    pckrImage.delegate = self;
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary]) {
            pckrImage.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

    if (isiPhone) {

            [self presentModalViewController:pckrImage animated:YES];

    }
    else
    {
        popOver = [[UIPopoverController alloc]initWithContentViewController:pckrImage];
        [popOver presentPopoverFromRect:CGRectMake(450.0f, 825.0f, 10.0f, 10.0f) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];       
    }
}

お役に立てれば。

于 2013-09-12T07:52:59.097 に答える