我已经在Xcode中将设备方向设置为仅勾选了“纵向”(Portrait)选项。
但是当我在模拟器中运行我的应用程序时,它会以所有方向旋转。
我的Xcode设置
在纵向(预期)和横向(非预期)显示正确
有人之前遇到过同样的问题吗?
谢谢。
Xcode中的“通用” -> “部署信息”界面可能会误导。请检查您的info.plist
文件中的以下两个键:
UISupportedInterfaceOrientations
以及
UISupportedInterfaceOrientations~ipad
UISupportedInterfaceOrientations
和 UISupportedInterfaceOrientations~ipad
都设置为 UIInterfaceOrientationPortrait
,但仍然无效。 - Roen func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
if self.allowOrentitaionRotation {
return .allButUpsideDown;
}
return .portrait;
}
info.plist
ж–Ү件дёӯзҡ„вҖңж”ҜжҢҒзҡ„з•Ңйқўж–№еҗ‘вҖқж•°еҖјгҖӮж¶ҰиүІеҶ…容并дҪҝе…¶жӣҙеҠ йҖҡдҝ—жҳ“жҮӮпјҢдҪҶдёҚиҰҒж”№еҸҳеҺҹжқҘзҡ„ж„ҸжҖқгҖӮ - Karlo A. Lópezinfo.plist
中包含了以下内容:<key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> </array> - Jeunginfo.plist
也没问题,有什么进展吗? - MattyK14