如何在iPAD中更改UIImagePickerController的大小?

时间:2011-05-10 13:17:46

标签: ipad

如何在iPAD中使UIImagePickerController的大小更大?示例MAC PhotoBoth应用程序。 http://www.youtube.com/watch?v=Ytl3EhNCP_8

我已经完成了代码。

- (void)openCamera {

    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
    {
        camera = [[UIImagePickerController alloc] init];
        camera.sourceType = UIImagePickerControllerSourceTypeCamera;
        camera.cameraDevice = UIImagePickerControllerCameraDeviceFront;
        camera.delegate = self;

        [self presentViewController:camera sender:nil animated:YES modal:YES];
    }
    else 
    {
        UIAlertView *objAlert = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"Camera not found" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

        [objAlert show];
        [objAlert release];
    }
}


- (void)presentViewController:(UIViewController *)vc
                       sender:(id)sender
                     animated:(BOOL)animated
                        modal:(BOOL)modal {

    CGRect cframe = self.capturedImage.bounds;
    //cframe =  CGRectMake(cframe.origin.x, cframe.origin.y/2.0, 351, 351);


    photoPopoverController = [[UIPopoverController alloc] initWithContentViewController:vc];
    [photoPopoverController presentPopoverFromRect:[capturedImage bounds] inView:capturedImage permittedArrowDirections:UIPopoverArrowDirectionUnknown animated:YES];
}

2 个答案:

答案 0 :(得分:3)

您可以使用transform:

//转换因子

  

#define CAMERA_TRANSFORM 0.34及以上

及以上,如果要调整大小,请使用:

  

camera.wantsFullScreenLayout = YES;

     

camera.cameraViewTransform = CGAffineTransformScale(camera.cameraViewTransform,CAMERA_TRANSFORM, CAMERA_TRANSFORM);

答案 1 :(得分:2)

您应该更改其视图的frame属性。 即。

UIView *view = imagePickerController.view;
CGRect frame = view.frame;
frame.size.height = new_height;
frame.size.width = new_width;
view.frame = frame;

它应该工作。否则,请告诉我们有关如何创建控制器,如何显示它以及哪些是其代表的详细信息。