无法在iPhone 6.0模拟器Retina 4英寸上全屏启动我的应用程序 [英] Unable to start my application in full screen on iPhone 6.0 Simulator Retina 4 Inch

查看:103
本文介绍了无法在iPhone 6.0模拟器Retina 4英寸上全屏启动我的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 Default-568h@2x.png 添加到我的项目并在项目设置中设置,我还为我的视图和元素设置了自动调整大小最初在我的应用程序上加载的视图是仅景观,但在iOS 6.0模拟器Retina 4英寸中运行我的应用程序后,我看到我的应用程序一直向左移动,在右边留下黑色像素区域。



为了看到我的应用程序在iOS 6.0模拟器Retina 4英寸上以全屏运行,我应该知道我应该做些什么吗?








我还编辑了我的AppDelegate.m像这样:

  viewControllerMain = [[ViewControllerMain alloc] init]; 
// [window addSubview:viewControllerMain.view];
window.rootViewController = viewControllerMain;








我设法实现全屏模式,但它没有按预期工作。我在我的观点中这样做:

  CGRect frame = CGRectMake([UIScreen mainScreen] .bounds.origin.x,[UIScreen mainScreen ] .bounds.origin.y,[UIScreen mainScreen] .bounds.size.height,[UIScreen mainScreen] .bounds.size.width); 
self.frame = frame;

这只会让我的视图全屏显示,但我在开头提到的右侧黑色区域是该领域的无法进行用户交互(我的UIButton在那里没有反应)。基本上,我所做的只是使我的视图以全分辨率显示,但视图中元素的功能仅限于我第一次在Retina 4英寸模拟器上启动时我的应用程序最初显示的区域。








<我甚至试图在我的XIB文件中改变UIView的实际大小,将它们全部调整为Regina 4全屏,但仍然 - 同样的事情。








我试图在AppDelegate中更改窗口对象的大小.m但又没有运气。以下是AppDelegate.m的外观。

  application.statusBarOrientation = UIInterfaceOrientationLandscapeRight; 

mainViewController = [[MainViewController alloc] init];
window.rootViewController = mainViewController;

//应用程序启动后自定义的覆盖点
[window setFrame:[UIScreen mainScreen] .bounds];
[window makeKeyAndVisible];








到目前为止,我做了以下操作:在IB中,我制作了具有iPhone 5分辨率大小的新UIViews,分配了相同的所有者类,这些类正在处理它们的等效UIViews对于iPhone 5之前的分辨率和代码我需要加载其中一些UIViews我检查[UIScreen mainScreen] .borders以确定当前正在运行我的应用程序的设备。通过这种方式,我设法让事情发挥作用。



但是,主要问题仍然存在 - 为什么在我做完所有这些后,我的所有UIViews都没有自动延伸到新的分辨率我提到过的事情是什么?



无论如何,赏金在5天或6天内仍然有效。如果有人设法解决这个问题,我将非常感激。如果没有,我会给予@ onegray 赏金,因为那是我在第一时间没有照顾的事情,而且在我目前的实施中它非常重要。



祝你好运。








建议@ user1702985 ,我将此选项开启视为它被取消选中。但没有运气



当我启动我的应用程序时,我用一个UIImageView显示一个View 2秒。如果我正确设置自动调整大小属性,则在iPhone 5模拟器上全屏显示此UIView。但。之后我有第二个UIView,其中包含垂直UIScrollView,UIViews作为页眉和页脚以及一个UIButton,我还为这些元素设置了所有自动调整大小选项,但是这个UIView显示在iPhone 4--分辨率中。这真的很奇怪,我仍然不知道它会是什么。








此自动调整大小选项是为我的所有UIView及其元素设置的。





< hr>



MainWindow。 xib属性。



解决方案

确保关键窗口的大小合适。解决方法是设置正确的框架: [window setFrame:[[UIScreen mainScreen] bounds]]



更新:

如果没有源代码,很难猜出问题出在哪里。
我创建了简单的应用存根来测试iPhone4 / iPhone5的界面方向。我刚刚创建了新的单视图应用程序,在根视图中添加了一些子视图,并添加了默认图像。我在Xcode 4.3.2中完成了它,没有 Xcode 4.5的任何额外功能。并且应用程序自动将其屏幕拉伸到适当的大小(对于纵向/横向方向)。


I have added Default-568h@2x.png to my project and set it in project settings, I have also set autoresizing options for my view and elements on that view which is initially loading on my application which is landscape-only, but after running my application in iOS 6.0 Simulator Retina 4 inch I see my application moved all the way left, leaving black pixel area on the right.

Any idea what should I do beside these things in order to see my application runs in "full screen" on iOS 6.0 Simulator Retina 4 inch?


[edit #1: AppDelegate]

I also edited my AppDelegate.m like this:

viewControllerMain = [[ViewControllerMain alloc] init];
//[window addSubview:viewControllerMain.view];
window.rootViewController = viewControllerMain;


[edit #2: Editing frame]

I managed to achieve full screen mode, but it's not working as it should. I do this in my views:

CGRect frame = CGRectMake([UIScreen mainScreen].bounds.origin.x, [UIScreen mainScreen].bounds.origin.y, [UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width);
self.frame = frame;

This only brings my view to full screen, but black area on the right I mentioned on the beginning is dead and no user interaction is possible in that area (I have UIButton there which doesn't react on touch). So basically, what I did only made my view appear in full resolution, but functionality of elements on view is limited to area where my app originally showed when I first started it on Retina 4 inch simulator.


[edit #3: Changing size of UIView's in XIB files]

I even tried to change actual size of UIView's in my XIB files resizing them all to Regina 4 Full Screen, but still - same thing.


[edit #4: Changing size of window object]

I have tried to change size of window object in AppDelegate.m but again no luck. Here's how AppDelegate.m look like.

application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;

mainViewController = [[MainViewController alloc] init];
window.rootViewController = mainViewController;

// Override point for customization after application launch
[window setFrame:[UIScreen mainScreen].bounds];
[window makeKeyAndVisible];


[edit #5: "Solution"]

So far I did following: In IB I made new UIViews with iPhone 5 resolution size, assigned same owner classes which are handling their equivalent UIViews made for pre iPhone 5 resolution and in code where do I need to load some of these UIViews I check [UIScreen mainScreen].borders to determine which device is currently running my application. In this way, I managed to get things work.

But still, main question remained - why didn't all my UIViews automatically stretched to new resolution after I did all those things I mentioned?

Anyhow, bounty remains active for 5 or 6 days. If someone manages to solve this issue, I'd be very grateful. If not, I'll give bounty to @onegray, since that was the thing I didn't took care of at first place, and in my current implementation it is really important.

Best regards.


[edit #6: MainWindow.xib Full Screen at Launch option]

As @user1702985 suggested, I turned this option ON as it was deselected. But no luck.

When I start my application I show one View for 2 seconds with one UIImageView on it. If I set Autosize properties right, this UIView is shown in fullscreen on iPhone 5 simulator. BUT. After that I have second UIView which contains vertical UIScrollView, UIViews as header and footer and one UIButton, and I also set all autosize options for these elements, but this UIView is shown in iPhone 4-- resolution. It really acts strange and I still don't know what can it be.


[edit #7: Auto-resizing options which are set]

This auto-resizing option is set for all my UIViews and it's elements.


[edit #8: Explanation of Full Screen at Launch option]

MainWindow.xib properties.

解决方案

Make sure that key window has proper size. Workaround is to set proper frame: [window setFrame:[[UIScreen mainScreen] bounds]].

Update:
It is difficult to guess where is the problem without having the source code. I've created simple app stub to test interface orientation for iPhone4/iPhone5. I just created new "Single View Application", added some subviews to the root view, and added "Defaults" images. I did it in Xcode 4.3.2 without any extra features of Xcode 4.5. And app automatically stretches its screen to proper size (for both portrait/landscape orientations).

这篇关于无法在iPhone 6.0模拟器Retina 4英寸上全屏启动我的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆