I have set the default device orientation to "Portrait" in info.plist. When I look into IPad, the app turns to landscape mode. How can I fix it to Portrait mode? It's working fine on iPhone.
There are two settings, one for iPhone and one for iPad, my guess is that you have chosen the correct settings for iPhone but did not change the settings for the iPad.
Perform the same setting for iPad and it will work.
You can read more about it in the documentation:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/device-orientation?tabs=vsmac
I hope this information will help you!
Related
I developed an application with Xamarin.Form it works very well on Android and also on Ios simulators but to my surprise when I deploy the application on Ios equipment the rendering is no longer the same.
Below are the captures
IOS
Ios
Android
Android
Please help
As xamarin.form does the same rendering I expected the same design on Ios but the rendering is good on Ios simulators but not on Iphone X
I give you some suggestions:
You could try to restart vc, clear the project, delete the bin folders and the obj folders and rebuild it. And iOS simulator you choose should also be iPhoneX.
In Settings App of iPhoneX, you could choose Display & Brightness section. Try switching Appearance from Light to Dark or Dark to Light to see if it make changes.
Hope it works for you.
Ok thank you for your comments.
Here is the solution for displaying it
In the info.plist file you have to add this:
<key>UILaunchScreen</key>
<dict/>
To make the page take up the whole screen
Regarding the black background, it is necessary to take into account the two modes of Ligth and Black theme of Iphone in its application.
I have set up different backgrounds for 'Light/Dark Appearance'
But when switching between Light/Dark mode within Xcode, my background always uses image from 'Any/Light Appearance'. Only colours set for icons changes accordingly.
FYI: I'm switching between Light/Dark mode using Interface Style option.
Can someone please advice what I'm missing on? It's all new to me.
I think it is an Xcode bug. You can confirm it by changing your setting in the iOS Simulator.
Go to Settings -> Developer -> Dark Appearance
I think you might need to uncheck the Resizing checkbox and set the Scales property to Single Scale. It worked for me.
Set your image to Render As Original Image
I think it's an Xcode (latest version) bug.
If you run it on your phone, you won't have this problem. Meaning settings are correct.
In Simulator it's working fine. One can confirm by toggling the Appearance from feature menu of the simulator.
This seems like an Xcode bug, but when you try to run it on your simulator or physical device, it should work perfectly assuming you are in Dark Mode.
By unchecking the Preserve Vector Data option 1, one can see the change in the background when switching between the modes from interface styles 2.
But I noticed that if you leave the option selected and test it on the simulator, it works perfectly fine there. Hence I feel it's an Xcode bug too.
The Xcode Bug is still here, Xcode storyboard appearance switcher does not work, it only works in the simulator.
You can change the simulator device appearance:
Settings> Developer> Dark Appearance.
Happy coding.
On my physical device iPhone 8 iOS 14.6 dark Mode doesn't work. traitCollectionDidChange not get called after switching to dark mode.
On my iPhone 12 iOS 15.x, and some testers it works.
No Solution i tried worked. Also i got some other weird UI bugs aswell on my iPhone 8.
Hope its just an Xcode Bug.
I've been trying to test my app on the iPad Pro going between portrait and landscape and for some reason the simulator does not switch... has this issue always been there and you need an actual device or is this a new issue? Thanks!!
Update: hope I don't sound confusing. The simulator switches, but the app doesn't. As you know iPad Pro apps are required to be landscape too, but it doesn't turn landscape on my simulator, the simulator goes landscape but the app is still in portrait.
We did not remove any rotation modes. Are you sure you have your project configured to handle rotation correctly?
Make sure your project settings allow all orientations and that your view controllers are returning the correct supported orientation values.
My app is supposed to run only on Iphone but apple is testing it on Ipad too. Apparently, the apps can run in Iphone mode on Ipads. How do I know which Ipad will run which Iphone mode (ex: ipad mini air2 = iphone 5 view settings in iphone mode?)?
How can I change the size of my UI based on changing aspect ratio programmatically ? (My views are created through code).
The iPad Pro runs an iPhone 6. The iPad 2 and Air 2 run an iPhone 4s.
I don't know if there's official documentation for this, but what I did is create a sample app and set the Devices to iPhone only. Then I added
print(self.view.frame.size) //Swift
NSLog(#"width = %f, height = %f", self.view.frame.size.width,
self.view.frame.size.height); //Obj-C
in the default ViewController. This will print the screen size of the view only, and not the entire iPad's screen. I then compared the printed value to the printed value of the same app run in iPhone 6/4s. You can try it too.
In terms of changing the size of your UI to fit different screen sizes, your best bet is probably AutoLayout. There are many (free, open source) frameworks available that make creating AutoLayout constraints programatically much simpler.
A few are Stevia, Cartography, SnapKit (Swift) / Masonry (Obj-C), or PureLayout.
As you said your app is supposed to run on iPhone only, then do the following process.
Select your project target in Xcode and goto General in which there is one section Deployment Info
Change the Devices to iPhone from dropdown
this will open app on iPhone only.
I submitted my game to the app store and it got rejected because it didn't comply to iPad sizing, were I specified on iPhone on Xcode.
Yet apple thought otherwise.
Am I missing something? Where else do I specify only iPhone? iTunes Connect?
Check that you have
Scene.scaleMode = .aspectFit
added in the ViewController.swift file.
I had it set to aspectFill and it messed up the iPad view. When I changed it to .aspectFit, it worked great.
You just need to adjust that is is a iPhone only app not a ipodtouch/iPhone. Then you should pass.
In the application's Build Settings change the Targeted Device Family to iPhone, instead of iPhone/iPad or to 1 instead of 1,2.
I added a screenshot but my app is universal so i have both 1,2 set.