简体   繁体   中英

UIImagePickerController bottom gets cut off when I add an overlay View

Need some help on an issue that is consuming my time. It's probably something really simple and I must be forgeting something. Here it go:

I have an UIImagePickerController in which I add a cameraOverlayView (just an ImageView). The problem is that the bottom bar gets cropped by some pixels. When I remove the overlay it works fine. I have even tried to change the overlay frame so that it fits the screen, the image is just the size of the camera viewport, but this happens even with small images. Here is some code:

UIImagePickerController* cam = [[UIImagePickerController alloc] init];
cam.sourceType = UIImagePickerControllerSourceTypeCamera; cam.delegate = self;

UIImageView *overlay = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"silhueta.png"]];
overlay.frame = CGRectMake(0, 0, [UIImage imageNamed:@"silhueta.png"].size.width, [UIImage imageNamed:@"silhueta.png"].size.height);

cam.cameraOverlayView = overlay;

[overlay release];

尝试将UIImageView的contentMode设置为UIViewContentModeCenter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM