我在iPad应用程序中遇到了横向模式的问题.
我创建了一个非常小的新项目来显示我的问题我将pList中的UIInterfaceOrientation设置为UIInterfaceOrientationLandscapeRight
在app delegate中
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self.window makeKeyAndVisible];
MyController *myController = [[MyController alloc] init];
[self.window addSubview:myController.view];
return YES;
}
Run Code Online (Sandbox Code Playgroud)
在MyController中
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
NSLog(@"Bounds Height:%f %f", self.view.bounds.size.height, self.view.bounds.size.width);
}
Run Code Online (Sandbox Code Playgroud)
我也试过在viewDidLoad中使用相同的结果
如果我在横向保持设备的同时启动应用程序NSLog输出
Bounds Height: 1004.000000 Bounds Width: 768.000000
Run Code Online (Sandbox Code Playgroud)
我需要做些什么才能获得正确的结果?我是这个iOS编程的新手,我要做的就是将UISlider锚定到屏幕的底部,但是当我得到不正确的坐标时,我不确定该怎么做.