iPad 方向问题 - 一个方向或全部四个方向 - 不能只让两个方向工作

发布于 2024-09-13 11:11:41 字数 1470 浏览 1 评论 0原文

我有一个 iPad 应用程序,我绝对需要横向显示,我知道建议的情况,但对于这个应用程序,它需要横向显示。

现在这是我的问题。

我已经编辑了我的 .plist 文件,以适当的方式支持横向左和横向右,并将自动旋转片段放入我的代码中,但是如果我有这个

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
/*if (autorotateOrientation && tapViewOrientation != interfaceOrientation && !insecureKeyboardWarningDialog) {
    tapViewOrientation = interfaceOrientation;
    [[NSUserDefaults standardUserDefaults] setInteger:tapViewOrientation forKey:kDefaultKeyTapViewOrientation];
*/
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);

[self prepareTapView];

// return NO; ,

我就只剩下风景了(显然)

如果我有这个

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
/*if (autorotateOrientation && tapViewOrientation != interfaceOrientation && !insecureKeyboardWarningDialog) {
    tapViewOrientation = interfaceOrientation;
    [[NSUserDefaults standardUserDefaults] setInteger:tapViewOrientation forKey:kDefaultKeyTapViewOrientation];
*/
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight);

[self prepareTapView];

// return NO; 我得到了所有四个方向

。现在我可以提出一个纵向选项,但说实话,它会很丑而且不起作用,因此我希望仅在这种特定情况下为横向工作。

谁能建议我做错了什么以及如何将自己限制为仅景观,但两种形式的景观?

I've got an iPad app that I absolutely need to have in just landscape, I know the situation on the suggestions but for this app it needs to be landscape.

Now here's my problem.

I have editted my .plist file to support both landscape left and landscape right in the appropriate manner and have put an autorotate snippet into my code, however if I have this

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
/*if (autorotateOrientation && tapViewOrientation != interfaceOrientation && !insecureKeyboardWarningDialog) {
    tapViewOrientation = interfaceOrientation;
    [[NSUserDefaults standardUserDefaults] setInteger:tapViewOrientation forKey:kDefaultKeyTapViewOrientation];
*/
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);

[self prepareTapView];

// return NO;
}

I get only landscape left (obviously)

if I have this

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
/*if (autorotateOrientation && tapViewOrientation != interfaceOrientation && !insecureKeyboardWarningDialog) {
    tapViewOrientation = interfaceOrientation;
    [[NSUserDefaults standardUserDefaults] setInteger:tapViewOrientation forKey:kDefaultKeyTapViewOrientation];
*/
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight);

[self prepareTapView];

// return NO;
}

I get all four orientations. Now I could just come upw tih an option for the portrait orientations however truth be told it would be ugly and non functional hence my desire to work for landscape only in this particular instance.

Can anyone suggest what I'm doing wrong and how to limit myself to landscape only, but both forms of landscape?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦中的蝴蝶 2024-09-20 11:11:41
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文