I am a low intermediate Xcode programmer. if I am not clear in something please bear with me and help me improve with feedback. Any feedback i am given, I will use to improve this question.
我是一名低级中级Xcode程序员。如果我不清楚某些事情,请耐心等待,并帮助我改进反馈。我给出的任何反馈,我都会用来改进这个问题。
I am using Xcode 6
我正在使用Xcode 6
I am currently making an Iphone Game. I set it up as a single view application. My problem is making it work on different Size IPhones. At first, I did not know how to make Xcode pick the screens depending on which Iphone it is being played on, but I managed to make it work. My game is not using Auto Layout, it uses different storyboards in which the view controllers are different depending on the storyboard. For example: MainIphone6.Storyboard will have Iphone 6 view controllers.
我目前正在制作Iphone游戏。我将其设置为单个视图应用程序。我的问题是让它适用于不同尺寸的IPhones。起初,我不知道如何让Xcode选择屏幕取决于它正在播放的Iphone,但我设法让它工作。我的游戏没有使用自动布局,它使用不同的故事板,其中视图控制器根据故事板而不同。例如:MainIphone6.Storyboard将具有Iphone 6视图控制器。
My game consists of tapping image views (they do have tap gesture recognizers), after they are tapped the image view will pick a random point on the screen and move to it. the point has boundaries which I set so it will not go to places I don't want it to.
我的游戏包括点击图片视图(他们确实有点击手势识别器),点击后,图像视图将在屏幕上选择一个随机点并移动到它。这个点有我设置的边界,所以它不会去我不想要的地方。
The first screen I made it work on was Iphone 5. It works perfectly. The second screen I made it work on was Iphone 4, the boundaries for the random positions are a little off do to the fact that it was originally programmed for iPhone 5, but I know how to fix this, that is not the problem.
我开始使用的第一个屏幕是Iphone 5.它完美运行。我开始工作的第二个屏幕是Iphone 4,随机位置的边界有点偏离它最初为iPhone 5编程的事实,但我知道如何解决这个问题,这不是问题。
The problem is that in my storyboards for Iphone 6 and 6 Plus, when the Image View is tapped, it doesn't move to the random point. This works on Iphone 5 and 4, but not on 6 and 6 plus.
问题是在Iphone 6和6 Plus的故事板中,当点击图像视图时,它不会移动到随机点。这适用于Iphone 5和4,但不适用于6和6 plus。
Why doesn't my code work for this Storyboard, but it works on other storyboards, while it is the same code for all?
为什么我的代码不适用于这个Storyboard,但它适用于其他故事板,而它是相同的代码?
Note: I have speculated that it may be related to the linking of view controllers within story boards, because on iPhone 5 and 4 i can link with the modal segue, but in 6 and 6 plus, it says it is deprecated. I only mention this if it might help...
注意:我推测它可能与故事板中视图控制器的链接有关,因为在iPhone 5和4上我可以与模态segue链接,但在6和6加上,它表示它已被弃用。如果可能有帮助,我只提这个......
1 个解决方案
#1
0
Hard to tell from just your description. Deprecated code will still work so I doubt it is that. Did you try changing you code so that the 6 and 6 plus used the working 5 Storyboard. If it does the 6 storyboard has a problem. In this case, kill the 6 Storyboards, duplicate the 5 Storyboard and modify it. Sounds like you may have been recreating each Storyboard anyway. In this situation I select the Storyboard in the Navigator and choose Duplicate from the File menu. This will save you some work and help guarantee that you do not make a mistake recreating all aspects of the Storyboard.
很难从你的描述中分辨出来。弃用的代码仍然有用,所以我怀疑是这样。您是否尝试更改代码,以便6和6 plus使用工作5故事板。如果它确实6故事板有问题。在这种情况下,杀死6个故事板,复制5个故事板并进行修改。听起来你可能一直在重新创建每个故事板。在这种情况下,我在导航器中选择Storyboard,然后从“文件”菜单中选择“复制”。这将为您节省一些工作,并帮助确保您不会错误地重新创建故事板的所有方面。
Also even if you do not want to use Autolayout, I would still use a single Storyboard and make the calculations in code.
即使你不想使用Autolayout,我仍然会使用一个Storyboard并在代码中进行计算。
#1
0
Hard to tell from just your description. Deprecated code will still work so I doubt it is that. Did you try changing you code so that the 6 and 6 plus used the working 5 Storyboard. If it does the 6 storyboard has a problem. In this case, kill the 6 Storyboards, duplicate the 5 Storyboard and modify it. Sounds like you may have been recreating each Storyboard anyway. In this situation I select the Storyboard in the Navigator and choose Duplicate from the File menu. This will save you some work and help guarantee that you do not make a mistake recreating all aspects of the Storyboard.
很难从你的描述中分辨出来。弃用的代码仍然有用,所以我怀疑是这样。您是否尝试更改代码,以便6和6 plus使用工作5故事板。如果它确实6故事板有问题。在这种情况下,杀死6个故事板,复制5个故事板并进行修改。听起来你可能一直在重新创建每个故事板。在这种情况下,我在导航器中选择Storyboard,然后从“文件”菜单中选择“复制”。这将为您节省一些工作,并帮助确保您不会错误地重新创建故事板的所有方面。
Also even if you do not want to use Autolayout, I would still use a single Storyboard and make the calculations in code.
即使你不想使用Autolayout,我仍然会使用一个Storyboard并在代码中进行计算。