UIImagePickerController has two 'camera' buttons when started as front-facing - ios

Since iOS6, whenever I show present a UIImagePickerController from inside a UIPopoverController, I am getting two "take picture" buttons:
This only happens when starting out in front-facing mode. If I start with the rear-camera and then switch after the popover appears, it's okay. Likewise, starting in front-facing and switching to rear will keep the second button there.
Even worse, the 'in picture' button doesn't work. It just tries to focus the camera at that point.
Anyone else seeing this or know of a solution? It doesn't happen when presented full screen, and I saw in Apple's docs that the popover is no longer the recommended way to present the image picker, but that it's also not necessarily bad, either. Unfortunately due to some external requirements, I need to keep it in a popover, and can't do full-screen.
Thanks!

I have exactly the same issue on iOS6. Odd behavior is that it appears only the first time I open the image picker. When closed and opened again, "in-picture" button disappears. Looks like a bug in UIImagePickerController.
To overcome this issue, you can hide image controls by setting showsCameraControls property to NO and use custom overlay view with own controls. Disadvantage of this is that you have to provide all controls then and code action handlers for them.
Unfortunately I didn't find a better way so far.

Related

Firebase Screen name issue with modal views in iOS 13 and above

In our app we are tracking screen views manually by adding relevant codes in viewWillAppear functions. With iOS 13, with the non fullscreen modals, the viewWillAppear of the parent screen won't get called when the modal is dismissed and hence wrong screen names are reported there after, for events originating from the parent screen.
I have checked the Detecting sheet was dismissed on iOS 13 , but the solution to implement  UIAdaptivePresentationControllerDelegate helps when you manually swipes down.
I then turned off manual tracking and turned on Automatic tracking and surprisingly the screen classes are determined right. Question is how Firebase is figuring that out?
Of-course I can't use auto tracking as we need custom screen names.
I believe this could be a generic issue for whoever using manual screen name tracking and have non full screen modals. Just wanted to check what's the best way to solve this.
Couple of ideas I had was
Make all modals full screen. Not nice for our app
Implement extra delegates in those modals to let the parent know its dismissed. Not sure its a nice way
Setting screen names on each event? Could that be even possible?
If there are any other nicer/ cleaner option let me know.

Presenting a second UIWindow causes the whole app to become unresponsive (on ios7)

So I'm trying to present a "modal view" that still shows the "presenting" view below as you will see in the GIFs below.
I am creating a UIWindow which I simply show over the "main" window. I'm retaining them both in my window manager class and it also does some simple animations.
It works well on the simulator, iOS8 and built with iOS8 SDK. It looks like this:
But when I open it on my actual device it doesn't work so well. See the GIF below.
Here's whats happening
The first presentation works well, animates the presenter and shows the modal. User activity is working.
The second presentation works 50%. The modal is shown, but the presenter does not animate. User activity working well.
The third presentation does not work at all, at this point the whole app is unresponsive, no taps/buttons/swipes are working
The NSLogs appears to have correct values.
Any ideas?
It appears changing [presentedWindow makeKeyAndVisible] to [presentedWindow setHidden:NO]; is solving my problem. I think I understand why but if someone comes in with a nice explanation I'll mark it as the answer.
EDIT The above was not the solution. It appears that I can present and dismiss it as long as I don't open the keyboard in-between.

Adding custom button to MPMoviePlayerController (fullscreen)

I have a MPMoviePlayerController instance in my iOS app, that plays a local file in fullscreen mode. This all works fine, but now I want to add a custom button to the window for changing the playback speed. We support both iPhone and iPad in all orientations.
I know how to set the playback speed from code (using setCurrentPlaybackRate), but I need to let the user do it while watching the video, which means adding some kind of button to the playback screen next to the existing buttons, e.g. next to "play", "pause", or in the top bar.
By looking on StackOverflow I have found various replies for questions similar but not quite the same, some saying it cannot be done in fullscreen, some saying it can be done (but is very complex) by creating some kind of overlay, effectively replacing the entire overlay with a custom one.
Although, I have yet to find any code examples (apart from a few snippets without context), getting-started style tutorial or similar for this, so any pointers to example code would be greatly appreciated.
maybe this Apple example could help you
https://developer.apple.com/library/ios/samplecode/MoviePlayer_iPhone/Introduction/Intro.html

Capture orientation change event before it happens in Titanium app

I'm doing an application in titanium. Different screens are a little complex, because they have a lot of images, views, and webview.
On simulator it works ok, but when I try it on device and I change the orientation of the device, the screen doesn't appear correctly.
For example, if I'm on portrait and I change to landscape, the elements appear like in portrait and then they are relocated to their new position, so you can see the transition.
Is there any way to solve it and don't see the transition?
Is it possible to put something above the view and when the elements are relocated remove it?
The only event I found to manage orientation change is: orientationchange, and if I put a view on the top in this event, I first see elements that aren't in their correct place. Is there any other event fired before the orientation change?
Thank you very much
I would approach this by creating and opening another window over the top of my current window. Once I complete the redraw to my hidden window, I'd close out the window I opened to block the view.
My concern would be that this operation may be too fast and the user will just see flickers and not understand what is happening. The flip side you could put a timer against it so the window shows at least for 1-2 seconds, but then that may be annoying to the user and deter them from changing the orientation.
You could get tricky with this and make the view invisible and then fade it in. Make sure the window has a background color or it may just show up in black or show something behind it depending on how your developed your project.
Ti.Gesture.addEventListener('orientationchange', function(e){
// ...
// Cover your current view with another window then remove the window when you complete
// the redraw.
});

Remove/hide Full screen button from MPMoviePlayerController Standard Controls

I want to remove/hide the full screen button from MPMoviePlayerController standard controls as full screen mode is creating lot of problems and also not a requirement of my app.I just want the play,stop,forward,reverse controls. Can anybody help me?
There's no standard way to do this. Here are your options.
You could set the MPMoviePlayerController's controlStyle to None and create your own custom controls. Cons: this is a lot of work.
You could use the NSNotificationCenter to intercept the MPMoviePlayerWillEnterFullscreenNotification and immediately set fullScreen mode to NO. Cons: based on the iOS version of the user, this may cause a flicker or some glitchy effect.
You could go through the MPMoviePlayerController view's subviews until you get to a MPInlineTransportControls view which contains the controls, the slider and the play/pause button and the full screen button which are all of class MPTransportButton. Find that one and you can hide it or remove it from its superview. Cons: as of right now this passes app store reviews and works perfectly on all currently supported iOS versions. But this could change at any time. If Apple decides to redo their default video player you may end up with non working code.

Resources