Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用其中一些方法,我可以检查我将设备旋转到的方向。但是我怎么知道我在加载应用程序时所处的方向呢?我想编写代码以通过检查我的方向的方式来重新排列 viewDidLoad 方法中的视图?
UIDeviceOrientation myOrientation = [[UIDevice currentDevice] orientation];
您还可以在 ViewDidLoad/ViewWillAppear 方法中使用类似于下面的内容。
if(UIInterfaceOrientationIsLandscape(self.interfaceOrientation)){ }