How can I fix the webpage orientation to Portrait only for iPad and iPhone? - iphone

I have developed a web app/website for the iPad but I can not get it stay in a fixed portrait view only.
I do not want it to rotate and work in landscape mode, because of the way the app has been designed.
I've tried various configurations of the viewport settings but that still has not worked.
I'm not very good at JavaScript so a copy paste option would be best or something in CSS/HTML.
Thanks in advance.

Unfortunately, there is no way to explicitly "lock" the orientation of a web-app in Mobile Safari, as you can also see from the link that Alex posted above in the comment:
How do I lock the orientation to portrait mode in a iPhone Web Application?
However, you can have multiple CSS files for different screen orientations. There's a handy JavaScript snippet that you can copy-paste here:
http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites
This should at least allow you to design around the rotation without having to use JS but just CSS.

Related

how to disable rotation in mobile browser in flutter web app

i am working on a flutter app where there is web app and in desktop its looking good but when i open it on mobile browser in portrait mode its correct and when the device is rotated the design is also rotated and the design breaks. how can i disable rotation of my web site in mobile browser even though the mobile is taken in landscape mode?
i have given this in main.dart but it doesn't made any difference.
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
I don't think you can avoid that with code: the orientation for a web app is dictated by the browser, so your app can try as much as it can but it won't go anywhere near succeeding. The browser is the master here, and it won't allow a single page to dictate its orientation.
I think that there's only an option here: work with CSS and write two different layouts, one for landscape and one for portrait (but I'm no expert in CSS, I can't help you), so that the landscape rotation will still have a good-looking design.
You can try to use this api in order to achive the behavior. Howewer, there is no guarantiee that clients browser would support that API, so most of apps implementing a fallback where they detecting current orientation and then ask user to rotate the device if needed.

Create Apple TV Apps in portrait orientation mode

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.

screen shots for app store submission

Do I have to submit both portrait and landscape screenshots?
Is it fine for my app to only support portrait mode?
Enough just a portrait screen shot - I submitted the app like that.
Yes, no worries about that :)
Best of all this document (perhaps you already saw it) tells about all of this.
Portrait mode only should be fine. I have app in app store that supports only portrait mode.
Your screenshots can be in any orientation you want. No specific requirement. Although I think now they have to be 640x960 for iPhone.
You can upload screenshots in what ever orientation you want, and yes its okay to only support portrait mode in your app.

UIInterfaceOrientation for default screen in iphone sdk

I am developing one iphone app, and i want to support all orientations.
The problem is that I want the default.png to be launched in the proper way according to the orientation at start up. Can someone post some method or proper name for default images so that I can rotate it?
Basically there is a landscape "default" image only for iPad. in iPhone you should suplly only one in the main orientation of your app.
anyway, if you want to do that, there is a workaround posted in this question:
Auto-rotate the default application image according to current landscape mode

iPhone app 'fake' landscape mode

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.