如何在屏幕中间显示UIimagepickerController

时间:2012-09-26 11:21:19

标签: iphone

我正在开发一个应用程序。我正在使用UIImagePickerController。那个将被打开整个屏幕。但是我需要在screen(50,50,220,380)的中间打开那个选择器。所以请告诉我我怎么能这样做呢。

1 个答案:

答案 0 :(得分:0)

我最终使用以下

在屏幕中间漂浮了一个可爱的微型相机imagePicker
 UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];

imagePickerController.delegate = self;
//  imagePickerController.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeImage, nil];
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
// imagePickerController.cameraCaptureMode = UIImagePickerControllerSourceTypePhotoLibrary;

UIView *controllerView = imagePickerController.view;

controllerView.alpha = 0.0;
controllerView.transform = CGAffineTransformMakeScale(0.5, 0.5);

[[[[UIApplication sharedApplication] delegate] window] addSubview:controllerView];

[UIView animateWithDuration:0.3
                      delay:0.0
                    options:UIViewAnimationOptionCurveLinear
                 animations:^{
                     controllerView.alpha = 1.0;
                 }
                 completion:nil
 ];