2011-05-10 83 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);