Remove the rotate icon in UIImagePickerController? - ios

is it possible to remove the little rotate icon in the UIImagePickerController that switches between the front & back cameras? This is for an app that won't goto the Apple Store, and it's only on one device. Anything i can do? I see that i can do this, but it removes the record button as well.
cameraUI.showsCameraControls = NO;

Unfortunately not, there is no direct way to turn off 1 particular camera control.
What you could do, is to do the following:
// Create a view that recreates the camera control functions you need.
// Your view will need to be able to set the following properties on camera UI
// cameraCaptureMode, cameraFlashMode (NOT cameraDevice, which is the control you want to disappear)
UIView* customOverlay = [..way to create your custom overlay..];
cameraUI.showsCameraControls = NO;
cameraUI.cameraOverlayView = customOverlay;
If you need to know how to create a custom overlay, it may be worth raising as another question.

its all or nothing when it comes to showsCameraControls. You need to either set showsCameraControls to NO and create your own cameraOverlay view, or roll your own camera using AVFoundation where again you'd need to create your own camera controls.

Related

How to make two screens show simultaneously like in snapchat?

I am creating a camera roll feature similar to snapchat where the camera is the bottom layer and then after tapping a button the camera roll appears. The camera roll does not occupy the whole screen the search bar on the top is still maintained and upon dismissal with a swipe gesture down the camera is still running. I am not sure how this affect is achieved. Is it done by using a scroll view or a segue of some kind? Thank you for your help.
Below is the video in question
Snap Chat Camera Roll
Firstly, this type of effect cannot be achieved using the standard camera UIImagePickerController. You will need to create your own camera view.
Here is a good guide to get you started: https://github.com/codepath/ios_guides/wiki/Creating-a-Custom-Camera-View
You could also try using a custom library that can be easily customized such as: https://github.com/omergul/LLSimpleCamera/
Now, in terms of the actual visual, I do not believe there is any actual segue/change of viewcontroller involved. The camera view is probably always on screen (except perhaps when it is fully covered by the Memories screen), it is simply overlayed by other things.
The Memories screen is most likely 'presented' in a custom manner. The show/dismissal logic can be achieved by attaching a UIPanGestureRecognizer to the UIView and translating the view up and down on pan event. If the pan's y value passes a certain threshold up or down, it automatically continues its animation to show or hide the view.

Hiding AVPlayerController full screen button

I am loading my AVPlayerController on a specified UIView. Is there a way to hide only the fullscreen button shown on the AVPlayerController?
What you can do is hide all the controls using:
YourAVPlayerViewControllerName.showsPlaybackControls = false
and then create your own custom controls for the player
EDIT:
Also as mentioned in the comments, you cannot remove only one button, if you need the excat the same then you need to customise your view based on your requirment
I'm afraid you cant, but you can create a customized player using AVPlayerLayer then you can do almost anything you want in it but you need to handle everything manually, slider and playback Controls and so.
there are already lots of tutorials on how to achieve that like this one

IOS Swift UIImagePickerController. How to access the bounds of the live camera feed?

Trying to create an app that uses the UIImagePickerController for its picture taking activities. I'm using a cameraOverlayView to accomplish this (for now, it just contains two buttons, one for Taking/Keeping the Picture and the other one for Canceling/Retaking). The steps below outline what is occurring.
UIImagePickerController.view (with cameraOverlayView) is shown
I click "Shoot" and the imagePicker does its magic and I'm able to get an image out of it. However going past the image acquisition section (after I dismiss the custom view), the imagePicker goes onto "still" preview screen mode without any controls other than the "<" back button at the top of the screen. I'd like to avoid that and instead continue to use my custom view provided to the cameraOverlayView to handle "Keep/Retake" actions until I'm finished.
As you can see in the image above, there is "black" band at the bottom of the view with my two custom buttons in it. I have no idea how the black band gets there since I did not add it. My custom View only has the two buttons.
Attempting to add an UIImageView on the fly (to display a still preview of the image taken to the user while still keeping my action buttons) has the effect below .
The red arrow is pointing to an extra section below the UIImage I added after acquiring the picture data from the imagePicker.
That section is actually displaying the live preview the imagePicker is constantly producing.
What I'd like to accomplish is to be able to get the bounds of that live preview section being displayed so I can calculate the correct bounds of the UIImage I'm adding on the fly since getting the height correctly will absolutely fail when ported to different devices.
Any suggestions?

How do I use [camera takePhoto] and edit using UIImagePicker - UIImagePickerController.allowsEditing = YES

I'm going to feel dumb but I've searched everywhere and have not found an answer. I've been able to pull up the "edit" view using the default camera's controls. However I threw an overlay on it and I have a UIButton hooked up to IBAction take photo which looks like [UIImagePickerController takePicture].
However, it totally skips the editing part even though I set allows editing to YES. Is there another command to call it? Right now, it just goes straight to didFinishPickingMediaWithInfo.
camera.sourceType = UIImagePickerControllerSourceTypeCamera;
camera.cameraDevice = UIImagePickerControllerCameraDeviceRear;
camera.showsCameraControls = NO;
camera.navigationBarHidden = YES;
camera.toolbarHidden = YES;
camera.wantsFullScreenLayout = NO;
camera.allowsEditing = YES;
camera.cameraOverlayView = overlay;
[self presentViewController:camera animated:YES completion:nil];
then in IBAction
[camera takePicture];
Possible duplicate: UIImagePickerController does not show edit screen
According to takePicture: method in Apple documentation:
Use this method in conjunction with a custom overlay view to initiate the programmatic capture of a still image. This supports taking more than one picture without leaving the interface, but requires that you hide the default image picker controls.
Calling this method while an image is being captured has no effect. You must wait until the associated delegate object receives an imagePickerController:didFinishPickingMediaWithInfo: message before you can capture another picture.
It seems that this approach (custom overlay) it is configured in order to be managed by yourself. Even if "allowsEditing = YES" the taken picture will be directly sent to imagePickerController:didFinishPickingMediaWithInfo:.
Based on that if we want to edit the taken picture using our custom user interface we should create an according custom edit screen for that purpose.
For future reference:
The problem of not showing the Edit screen is associated with the camera.showCameraControls = NO; the presence or absence of overlay has nothing to do with it (as the current accepted answer states)
Possible workaround:
on your IBAction [camera takePicture] set them again to YES. They will be shown only for a fraction of a second and that will allow the edit screen to appear. Then you will have a problem when hitting "Retake", in that case you have to capture that action via delegate and hide them again there.

iOS Retractable Menu

I am currently developing an app that contains a music player. As of now it has a play, pause, & a select song button that shows the current song playing. Right now, the player is always on the screen. I want to make it so theres a button in the middle of the page so that when users click that, the whole media player with the play, pause, and select song button/icon will appear. When they click on that middle button again it shall hide those icons.
If anybody could point me in the right direction whether it be tutorials already out, or other discussions (I could not find any ones really) that would be awesome!
NOTE: I'm not trying to make the popover menu that facebook uses. This menu/audio player will expand/retract horizontally over the current view
Thank you in advance!!!!
Sounds like you need to look into the .hidden property of view objects (allows you to make views visible/not-visible), and possibly the ability to move views around on the screen with the .frame property (setting location, height/width).
Without some more detailed information about the effect you're trying to achieve, it's difficult to say more than that. If you use interface builder to set up the view/UI-objects you want to display, you can simply set the base view to hidden in interface builder and then when the user clicks your button set .hidden=NO for that view.
Note: to be able to show/hide everything as a unit like this, I'm assuming that you use a single UIView object in interface builder as the container (sized and placed where you want it) and then add your controller buttons as sub-objects inside that single view. This allows you to show/hide everything by just setting .hidden property for the containing view.
I'm not exactly sure what visual effect your looking for, but I think you already said it - just hide them.
You can do that a couple of ways.
One simple way is just to put those elements inside of their own view. Use a storyboard or xib file. Put your buttons and controls you want to hide show in a view.
Then create a reference in your view controller to that view. call it controlsView.
#property (strong,nonatomic) IBOutlet UIView *controlsView;
Make sure you connect that view.
Then when the button is pushed, just hide that entire view:
self.controlsView.hidden = YES;
When pushed again, show it:
self.controlsView.hidden = NO;
If you want a bit smoother look and feel, wrap it in an animation like this:
//to hide
[UIView animateWithDuration:2 animations:^{
[self.controlsView setAlpha:0];
} completion {
self.controlsView.hidden = YES;
}];
//to show
self.controlsView.alpha = 0;
self.controlsView.hidden = NO;
[UIView animateWithDuration:2 animations:^{
[self.controlsView setAlpha:1.0];
} completion {
}];
hope that helps

Resources