最小化UIImagePickerController视图

时间:2012-05-18 10:30:19

标签: iphone ios ipad

我正在开发相机应用程序。我想限制特定尺寸的图像内容,但通过相机的图像是全屏显示的。我怎样才能最大限度地减少它?

- (void) viewDidAppear:(BOOL)animated {
    OvlayView *overlay = [[OvlayView alloc] initWithFrame:CGRectMake(472, 158, 240, 128)];

    // Create a new image picker instance:
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];

    // Set the image picker source:
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;

    // Hide the controls:
    picker.showsCameraControls = YES;
    picker.navigationBarHidden = YES;

    // Make camera view full screen:
    picker.wantsFullScreenLayout = NO;
    picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);

    // Insert the overlay:
    picker.cameraOverlayView = overlay;
    /*UIGraphicsBeginImageContext(CGSizeMake(480,320));

    CGContextRef            context = UIGraphicsGetCurrentContext();

    [image drawInRect: CGRectMake(0, 0, 480, 320)];

    UIImage        *smallImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();*/
    // Show the picker:
    [self presentModalViewController:picker animated:YES];  

    [super viewDidAppear:YES];
}

0 个答案:

没有答案