Apple recently decided to allow developers to use this UIGetScreenImage private API.
I have implemented it and it works fine in portrait, but when I run the device to landscape (self.view rotates) and UIGetScreenImage continues to capture using the screen non-rotated coordinates.
The result is a cropped landscape result.
UIGetScreenImage is the only method that works in my case, as far as I know and until you guys don't find an answer to this other question of mine :-)
I believe you need to apply the rotation yourself.
UIGetScreenImage() doesn't care about the orientation. In fact it cannot, because there can be multiple UIWindows on screen while some are autorotated, some are not.
Related
For my business purpose we have to place Apple TV in portrait mode. How can I create an app that have portrait orientation?.
The concept from an SDK perspective does not exist. None of the rotation-related methods from iOS made it over to tvOS, and for a good reason. With that said, there is still a small segment where it could be useful to have your tvOS application being rendered with more vertical than horizontal space.
You can read this post for some help.
I've looked around and tried different things but none of them seem to work well.
I want to be able to push a view which is supposed to be portrait only when the device is currently orientated in landscape and the other way around.
I've setup shouldAutorotate, supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation properly. They work when the device is manually rotated. However fails if the device isn't rotated. Once rotated, they work as expected. It's only the initial presentation that doesn't work.
Is there a way to force the OS to make calls to the above methods? I tried "present modal view controller hack". This worked fine on 6.0 but doesn't do well on iOS 7.0.
So, is there any way to get this to work? Or do you guys suppose asking the user to rotate the device before pushing the view to be a better solution?
Looking forward to your replies. Do keep in mind, I need support for both iOS 6 & 7.
Thanks,
Nathan
If it's working properly after the rotates, perhaps all it will take is to run part of your code in the viewDidLoad.
Never ask the user to rotate (or do anything for that matter) to get something working properly. It would give a very negative user experience, in my mind at least. All it takes is a little more time and effort to get it working properly. :)
hi so far i have used UIImagePickerController for camera activities in IOS3. But in IOS4 the ImagePickerController is not working properly. When i tried to capture image it shows either a white image or else the app gets crashed often.
So i started using the AVCapture device for my camera activities. In this too i started facing new problems. When i capture the image in landscape the image preview shows the image to be portrait and vice versa. And some times it shows memory level warning.
Both the UIImagePickerController and the AVCapture are making problems. I want to know how to solve these problems. Else is there any other way to handle camera activities in IOS4.
Please help me friends.....
If you just want to enable the user to take photos, UIImagePickerController is the way to go. AVFoundation is quite low level and requires you to handle a lot of things yourself (e.g. compensating for the device orientation).
I've used UIImagePickerController extensively on iOS 4 and it works just fine for me. I suspect the white image/crashing problems are due to something else in your code. If you post a few code snippets we can try to figure out what's going on.
So after wasting many hours trying to get my app to run in landscape mode by defualt I'm looking for an alternative.
My idea is to create the app in portrait mode but rotate everything by 90 degrees, the player thinks that he is playing the game in landscape mode (when really I've just rotated everything). I recognise it will be a little awkward to develop but I come into all sorts of issues when I try to program for landscape.
My question is, does Apple frown upon this? Could they reject my app for any reason or is this safe to do? Are there any issues I should be aware of?
Advice/articles/help all appreciated.
I do not allow landscape mode in my applications and none of them have been rejected. Sometimes an application does not benefit from being in landscape mode.
EDIT: The same also goes for portrait mode. If your app makes sense only in one orientation or the other, Apple will not reject you.
There is a key you can put into your Info.plist to make it start in landscape (see here). Or have you already tried that?
There are reportedly immersive full screen Open GL games that hide the status bar and do this. Note that you will still need to detect and handle landscape-left and landscape-right rotations or your app might appear upside-down.
Just set an affine transform on your top-level view, and be careful to always use the correct coordinate system.
Lately, I have received a text from the QA folks saying that the developed app's orientation is incorrect on iPhone 3, while it can display correctly on iOS 4. They say on iOS 3, the app's orientation is on portrait view, which makes the app leaving gray space below. However, they claimed that on iOS 4, the orientation is correct.
I test their claims on my 3GS (using iOS4). My app is always rendered correctly on my iPhone. It's pretty strange, because:
The app has been developed before the release of iOS4, and the codes for rotation is left intact. This implies that the rotation works correctly for iOS3 in the past.
I run my app using base 3.2.3 version, and I could not produce what the QA is claiming. This applies to both the simulator (tested on both iOS 3.2.3 and 4) and the actual device. (which uses iOS4)
The rotation works since iOS3, and it also works on iOS4 on my iPhone.
This is a very strange case, and without being able to reproduce the bug the QA is claiming. So in this case, I need some advice, could you possibly list out all of the methods for the orientation? This is overkill, of course, but without able to reproduce their claims, I really need a way to force the app to always force orientation on a landscape view.
So I've jotted the following:
edit the plist for initial interface orientation for landscape orientation.
application setStatusBarOrientation method. Possibly do this in the viewWillAppear method of the ViewController.
in the method: shouldAutoRotateToInterfaceOrientation, set the desired orientation only.
Any help is really appreciated.
Okay, I think I now know what's really going on, after trying things on my own. The orientation is already always on landscape, and all I need is manual translation of the view for older iOS. iOS4 seems to be smart enough to handle this, I presume?
If your rotation code is setup correctly, you should need to have any version specific cases. If views do not reply with YES to shouldAutoRotateToInterfaceOrientation: for the orientations you desire, you will get unexpected results for automatic rotations.