2011-05-10 88 views
1

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

代码已经完成了。

- (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]; 
} 
+0

这是一个很老的线程,但我需要做同样的事情......你有没有找到一个解决方案???如果您发现解决方案,然后提交可能对其他人有帮助的答案,则为 – HackyStack 2012-04-11 18:49:30

+0

。 – Ayaz 2013-01-04 05:51:54

回答

2

您应该更改其视图的框架属性。 也就是说

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

它应该工作。否则,请给我们更多关于如何创建控制器的细节,如何显示它以及哪些是其代表。

+1

它试过这个,但它不影响在iPad ImagePickerview – Sezhian 2011-05-10 14:07:18

+0

请给我们更多的细节,或一些代码来看看。你如何实例化并显示该控制器? – marzapower 2011-05-10 14:11:39

+0

您正在阅读和修改框架,但不会重新分配框架。这样你的自定义就会丢失。 – marzapower 2011-05-10 14:14:46

3

您可以使用变换:

//变换系数

#define CAMERA_TRANSFORM 0.34及以上

以上,当你想调整它的大小,使用:

camera.wantsFullScreenLayout = YES;

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