2

If there is a black bar at the bottom of the screen(like in the pic that i've pasted below), we have to re-scale the live screen camera overlay to fit the aspect ratio of iPhone. And even if I change the Y value from 1 to 1.234(for iPhone 4), it will fill up the bottom black area and the entire view will be covered by the live screen camera. So far it looks fine. But I want to keep the bottom black area as it is and want to reduce the size of the live screen camera only from the top margin, so that there are two black areas of equal sizes both at the top and at the bottom of the screen.

enter image description here

So in this piece of code, if i try to change the value of CAMERA_TRANSFORM_Y from 1.234 to 0.8,

#define CAMERA_TRANSFORM_X 1
#define CAMERA_TRANSFORM_Y 1.234

  self.picker.cameraViewTransform = CGAffineTransformScale(self.picker.cameraViewTransform, CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);

the size of the live screen camera reduces both from the top and from the bottom margin, creating a larger black area at the bottom, but a smaller black area at the top(like in this pic),

enter image description here

Hence, I want the two black areas to be of equal size both at the top and at the bottom, inorder to align the live screen camera at the center of the view. Can anyone tell me how to get this done? This is my project file(click on done button to open up the live screen camera in my project),

Custom camera

4

2 回答 2

0

我首先在当前视图中添加了一个黑色的 uiview 来实现这一点。然后,我将 UIImagePickerController 的视图添加到我想要的位置的黑色视图中。

  [self.view addSubview:blackView];
  imagePickerController.view.frame = 
        CGRectMake ( 0,
                     100,  // make this how far down you want the camera view
                     imagePickerController.view.frame.size.height,
                     imagePickerController.view.frame.size.width)

[blackView addSubview:self.imagePickerController.view];

于 2013-12-16T04:53:00.923 回答
0

你试过这个吗?

self.cameraView.center = self.otherView.center;
于 2013-09-07T22:16:46.923 回答