I am using UIImagePickerController() to display camera in my swift iOS app and let user take pictures. I would like to show a grid as overlay so I started implementing one as .cameraOverlayView
The problem is that the overlay image or views will spread over the black bars on top and bottom of the camera view. This is undesirable as the grid line will run over the camera button, cancel button etc.
I could not find a method to access the frame of the camera preview window to constraint the overlay just to that. What am I missing?
Actually, this may be a little annoy, there is no way to get the sizes of those bars or the camera preview area, and you can't achieve the subviews of UIImagePickerController and so you can't add constraints for that.
But, you can use the fact that the preview camera area aspect ratio is known as 4/3 always and the overlay width should be the width of the screen and the height should be the (widthScreen / 3) * 4
another way is to set imagePicker.showsCameraControls = false and build custom controls with the overlay on fullScreen.
(use the imagePicker.cameraViewTransform in order to set the camera preview area frame full screen).
Related
I have created background images for all iOS devices. As far as I understand, iOS will pick the appropriate image at runtime according to screen resolutions.
Is there a way to set the image as a screen background for the root view? The method should take automatic image picking into account.
Is there a way to set the image as a screen background for the root view
In the storyboard, locate the scene representing the root view controller and its view. Drag a UIImageView into the main view and pin its top, left, bottom, and right to the edges of its superview with a constant of zero. Send it to the back so that it's behind all other subviews of the main view. Set its image to the desired image, and supply an appropriate content mode. Done.
I have an image that is 1000x134 referred to as logo
I have an UIImageView that contains that logo as AspectFit
I have another view in the back
The user is allowed to pan, pinch, and rotate the logo to position it where ever they want on top of the background view
After they have positioned the logo, I then increase the size of the background view
Problem: After the background view's size gets increased, the position of the logo gets messed up.
Question: How do I scale the logo with the background view in order for it to appear in the same position?
You should make the UIImageView a subview of your background view. That would make it easy to resize the whole view, perhaps using self.view.transform.
I have have create 2 separate view controller for create functionality same as iPhone camera screen with all defaults filters.
Functionality working as per my requirements.
Now I have issue with view animation. How can I achieve same effect while user press on filter icon (left corner) in default camera and full camera screen after selecting any filter.
Look at below screen for more.
Thanks!
You can use a UIView for your filter options instead of UIViewController. Then you can animate whatever you want on the view.
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/#//apple_ref/doc/uid/TP40006816-CH3-SW108
I know the camera is 3:4 so there will be a black gap at the bottom.
Now I create a custom cameraOverlayView which has a NavigationBar at the top. So is that possible move the camera view lower that can fill the rest of the screen?
I've problem to resize the tabbar in camera view.
Is it possible to decrease the height of the camera tabbar in iPhone5?
Are you talking about a camera view presented from a UIImagePickerController? Because if so, no. There is no direct way to customize the action bar of of the image picker beyond adding other views on top of it. You'd probably have to create a custom capture setup using some of the stuff in AVFoundation.