- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我已经开发了一段时间并发布了游戏的引擎现在正在颠倒地启动我当前的项目,并立即按照预期的方式旋转 UIView。我用代码创建界面,这是关于它的样子:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
CGRect screenBounds = [[UIScreen mainScreen] applicationFrame];
CGRect windowBounds = screenBounds;
windowBounds.origin.y = 0.0;
UIWindow* win = [[UIWindow alloc] initWithFrame:windowBounds];
win.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
UIMyView* view = [[UIMyView alloc] initWithFrame:screenBounds];
UIMyViewController* controller = [[UIMyViewController alloc] init];
controller.view = view;
view.multipleTouchEnabled = true;
view.windowWrapper = this;
view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[win addSubview:view];
...
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation;
{
s32 validOrientations = ((cViewMM*)(self.view)).windowWrapper->GetValidOrientations();
if (toInterfaceOrientation == UIInterfaceOrientationPortrait && (validOrientations & 0x01))
return true;
if (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown && (validOrientations & 0x02))
return true;
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft && (validOrientations & 0x04))
return true;
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight && (validOrientations & 0x08))
return true;
return false;
}
只有当我想在 UIInterfaceOrientationLandscapeLeft 中启动应用程序时才会出现问题。通过应用程序调试时,当我尝试在内部将我的 View 添加到窗口时, shouldAutorotateToInterfaceOrientation: 被多次调用。首先是返回 false 的 UIInterfaceOrientationPortrait,然后是返回 true 的 UIInterfaceOrientationLandscapeRight(因为它是有效的方向),然后是 UIInterfaceOrientationLandscapeLeft,它也返回 true(因为它是有效的方向并且是设备的当前方向)。
哦,更具体地说,这只发生在 iPhone 上,而不是 iPad 上。他们使用相同的代码来设置此 View 。
我做错了什么?
-- 编辑--
好吧,我对 shouldAutorotateToInterfaceOrientation 的执行是错误的:它执行了 3 次请求 UIInterfaceOrientationPortrait,2 次请求 UIInterfaceOrientationLandscapeLeft,然后一次请求 UIInterfaceOrientationLandscapeRight,再执行一次 UIInterfaceOrientationLandscapeLeft。
此时 GameCenter 已经在初始化,因为它正在推送一些额外的 UI,我认为可能是这样,但事实并非如此。
最佳答案
在您的 Info.plist 中检查支持的方向数组以纵向(右侧朝上)开始。如果它以任何不同的方向启动,您的应用程序将以该方向启动。
关于iphone - 我的应用程序开始颠倒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7797953/
我正在尝试将我的本地功能分支 rebase 到名为“集成”的远程分支上。 所以我做了- git checkout feature git rebase integration 但在我的冲突解决编辑器中
我想使用模板来反转 XML 的不同序列; 例如 :
我正在尝试使用 Django 1.8 构建我的博客,但是我不知道如何订购这些博客。看图 我想在底部显示“最早”,在顶部显示“最新”。这是我的 index.html {% extends 'layout
我正在使用 socket.io 并向客户端发送一条消息,其中包含应附加到 div 的数据: socket.on('new data', function(data){ $('#containe
如果我遗漏了明显的内容,我深表歉意...... 我正在使用 rgl 绘制 3d 曲面。我的代码是 library(rgl) dem1 = read.table(file="file.txt",skip
如何使用纯 CSS 反转 div 子元素的顺序? 例如: 我要 A B C D 显示为: D C B A 我在 JSfiddle 上创建了一个演示: http://
是否反转中的属性 到 削弱或以任何方式影响搜索引擎索引页面的能力? 谢谢:) 最佳答案 我们不可能知道。搜索引擎可能有错误。 但从 HTML 规范的角度来看,不,属性顺序不影响含义。 关于html
我正在使用 CABasicAnimation 绘制我在数组中使用 CAShapeLayer 的所有 UIBezierPaths CAShapeLayer *shapeLayer = [CAShapeL
我在我的 iPhone 应用程序中使用 core plot 1.0。一切正常,图表绘制完美,但我面临一个奇怪的问题,即图表页面 (CPTPGraphHostingView) 上的所有控件都被镜像。 即
我是一名优秀的程序员,十分优秀!