Autorotate Portrait mode documents if it is showing as landscape - ios

In my app user scans(captures photos of) documents. For uploading to the server.
I want to programmatically detect the document's orientation.
It looks like this.
And then user tap that circular arrow button and make it portrait.
Then it looks like this
I want to do this rotation task automatically.
Please let me know how we can do this, I never came across this kind of requirement.

Related

Delegate fullscreen event AVPlayer objective-c

After several sleepless nights, I don't have any more ideas how to do what I am trying to do.
In short words, I am trying to allow my fullscreen video to be accessible in all orientations (landscape and portrait). This is the only place in the app where I want to allow that. All other views are locked to portrait.
My idea was to delegate fullscreen enter / exit event and in that place, programmatically set orientation allowance, so on fullscreen enter, unlock landscape additionally and on fullscreen exit, lock back only to portrait. Everything works fine apart from the one crucial part...I can not delegate fullscreen enter/exit event (delegating those events was my idea but I might be completely wrong and that should be managed in completely different way)
I am using this library: https://github.com/brentvatne/react-native-video
Thanks in advance for any help!

Is it possible to programmatically force an iOS app in split view / slide over to go full screen in ios9?

I'm implementing an app that needs a camera preview using AVCaptureSession. Unfortunately iOS9 will interrupt the AVCaptureSession as soon as Split View or Slide Over is on. The system allows to detect such an interruption (see: https://stackoverflow.com/a/33086527/1896336).
The good thing is that we can warn the user to go Full Screen but I was actually wondering if we could programmatically set the app to go Full Screen when the user taps a "yes take me back to full screen" button ?
No. If you don't like this behavior, don't use iPad Multitasking (opt out by insisting on full screen in the Info.plist).

iPad forces portrait mode when touching 'Take Photo or Video'

I've built an HTML5 iPad web app in landscape mode, now I'm to the point I need to let the user add an image either from taking an image or choosing one from the camera roll.
Here's the problem:
The iPad is locked in landscape mode, user touches my button: 'Add Photo' Apple menu alerts: 'Take Photo or Video' or 'Choose Existing' User touches 'Take Photo or Video'.
When the Camera slides over and opens up the web app goes into portait mode!, and after the user takes the image or even cancels out of taking an image my web app is stuck in portrait mode and will not go back into landscape until you unlock the iPad, turn to portrait then back to landscape!!
Note: if the user selects 'Choose Existing' and uploads from the camera roll there is no issue.
Is there anything I can do? Is there a way to not provide the 'Take Photo or Video' option and only allow the 'Choose Existing' option?
Thank you in advance!
I've run into a similar problem. In my case the camera roll is only showing in portrait mode on my iPad which I'm using in landscape. After looking through the API reference it looks like this is by design:
Important: The UIImagePickerController class supports portrait mode
only. This class is intended to be used as-is and does not support
subclassing. The view hierarchy for this class is private and must not
be modified, with one exception. You can assign a custom view to the
cameraOverlayView property and use that view to present additional
information or manage the interactions between the camera interface
and your code.
UIImagePickerController Reference

Force rotation without user knowing

My app allows a user to create an invoice. Data can be input in either landscape or portrait.
The user is then able to save the quote and view saved quotes in a collection view. Similar to Pages on iOS. The size of the tiles are the aspect ratio of the device in portrait view.
So if the user saves a quote I generate a screen shot of the view and save it so that it can be viewed in the tiled view (like iOS pages). This works all fine if the user saves when the device is in portrait. If they save while landscape it sucks.
So my question is, there a way I can rotate the view behind the scenes, generate a UIImage from it all without the user knowing noticing any orientation change.
If you are running the code that rotates it and takes a screenshot in the same thread then as long as you rotate it back before the thread finishes running, the device's screen will not update. Simply rotate everything (or if you have too many objects to rotate, take a screenshot of it all then rotate that screenshot) now take a screenshot of your new rotated view (or if you took a screenshot and rotated it don't do anything, you're done) then rotate everything back (again unless you just took a screenshot then rotated that)... If you need a screenshot method that can run in 1 thread use the CGContext code.
(To answer your question, rotating is always behind the scenes, it only becomes "in front" of the scenes when your thread ends... so if you rotate it back before the end of your thread the user will never see it because the device's screen will not update until after it has been rotated twice, there and back again.... bingo!)

MPMoviePlayerController done button, Landscape orientation

I'm using simple MPMoviePlayerController. In portrait mode it is emmbedded into my layout. When I rotate my device I want it to go full screen. In full screen mode there is a done button but only thing it does is pausing the video. I want to dismiss modal view controller when the done button is tapped. How can I do this?
I've tried:
Putting a [UIColor clearColor] on a background of a button and place a button over Done button thus intercept touch event into my own selector. It failed because my custom button isn't displayed when MPMoviePlayerController is in fullscreen mode.
Going to notification center and trying to catch "willExitFullscreen" but it won't occur (pressing done button when in landscape fullscreen mode isn't goint out from the fullscreen mode).
Finding done button in the MPMoviePlayerController... but I was unable to find it.
Using MPMoviePlayerViewController isn't an option as I want to be able to use embedded player in my controller when i Portrait mode, and be able to rotate movie without loading it from scratch (so pushing new controller when user changes device orientation isn't right solution for me).
I've read a few topics on this issue and question can be the same or similar but anserws require either things I've checked (i.e. notifications) or things I can't use (MPMoviePlayerViewController).
ANSWER (as I am unable to post it in 7h)
Heh ok..
The culprit of this whole mess was this line of code
[self.mpPlayer setControlStyle:MPMovieControlStyleFullscreen];
So it seems that setting Fullscreen control style when going into fullscreen mode will break done button....
Makes no sense to me. But when I commented out this line I am able to recive willExitFullscreen notification and I can work with that.
The culprit of this whole mess was this line of code
[self.mpPlayer setControlStyle:MPMovieControlStyleFullscreen];
So it seems that setting Fullscreen control style when going into fullscreen mode will break done button....
Makes no sense to me. But when I commented out this line I am able to recive willExitFullscreen notification and I can work with that.

Resources