简体   繁体   English

iPhone开发者-具有情节提要的Multiview应用

[英]Iphone dev - Multiview app with storyboard

I have seen some tutorials about iphone development, but they're before ARC and before storyboard it seems. 我看过一些有关iphone开发的教程,但它们早于ARC和故事板。

The guy creates a switch that will switch between two views. 这个家伙创建了一个可以在两个视图之间切换的开关。 A class with a blue background, and a class with a red background. 一个类有一个蓝色背景,一个类有一个红色背景。

How would you do this in IOS5 with storyboard? 您如何在带有故事板的IOS5中做到这一点?

I've heard about segues, but they get a 'back' button, which the guy in the tutorial didnt get - he simply changed between views my tapping the switch/button. 我听说过segue,但是它们有一个“后退”按钮,本教程中的那个家伙没有得到-他只是在我点击开关/按钮的视图之间进行了更改。

You better go through this tutorials to understand how to develop app in IOS 5. The tutorials, which you have already seen are for ios4 and prior to it. 您最好阅读本教程,以了解如何在IOS 5中开发应用程序。您已经看过的教程适用于ios4及其之前的版本。 Also you can use those in IOS 5 too. 您也可以在IOS 5中使用它们。 But Storyboard is much easier than XIB. 但是Storyboard比XIB容易得多。

http://www.techotopia.com/index.php/IPhone_iOS_5_Development_Essentials http://www.techotopia.com/index.php/IPhone_iOS_5_Development_Essentials

http://www.techotopia.com/index.php/Using_Xcode_Storyboarding_%28iPhone_iOS_5%29 http://www.techotopia.com/index.php/Using_Xcode_Storyboarding_%28iPhone_iOS_5%29

Anyway @dew given you the correct answer. 无论如何,@ dew给了您正确的答案。

You need to add 2 View Controllers into your storyboard and then embed in navigation controller. 您需要将2个View Controller添加到情节提要中,然后嵌入到导航控制器中。 After you create some button in one view, you just gotta ctrl-drag it to the other view and select push, that should do it. 在一个视图中创建某个按钮后,只需将其按ctrl拖动到另一视图并选择“ push”即可。 Or simply chech out this tutorial http://maybelost.com/2011/10/tutorial-storyboard-in-xcode-4-2-with-navigation-controller-and-tabbar-controller-part1/ :) 或者只是简单地选择本教程http://maybelost.com/2011/10/tutorial-storyboard-in-xcode-4-2-with-navigation-controller-and-tabbar-controller-part1/ :)

I would highly suggest watching the first 2 or 3 lectures of Stanford's CS193P introductory iPhone programming course. 我强烈建议您观看斯坦福大学CS193P iPhone编程入门课程的前2或3讲。 It's free and will start you off on the right foot. 它是免费的,它将使您从右脚开始。 It's also targeted for iOS5 and Xcode 4. Check it out at: http://itunes.apple.com/itunes-u/ipad-iphone-application-development/id473757255 它还针对iOS5和Xcode4。请访问以下网址查看: http : //itunes.apple.com/itunes-u/ipad-iphone-application-development/id473757255

To answer your question, moving between view controllers is usually done using a container controller or pushing view controllers 'modally'. 为了回答您的问题,通常使用容器控制器或“有模式地”推动视图控制器在视图控制器之间移动。 I would suggest reading the View Controller Programming Guide put out by apple for an overview of how these things work. 我建议阅读Apple发行的《 View Controller编程指南》,以概述这些工作原理。

In iOS5 you can use storyboards to set-up segues (as you suggested). 在iOS5中,您可以使用情节提要来设置segue(根据您的建议)。 They don't always 'give you a back' button, only when you segue between view controllers within a navigation controller. 仅当您在导航控制器中的视图控制器之间选择时,它们并不总是“给您后退”按钮。 You can have a button push a view controller onto a screen by setting up target-action. 您可以通过设置target-action来将视图控制器推到屏幕上。

Again, the iTunesU lectures will cover all this. 同样,iTunesU的讲座将涵盖所有这一切。 Check it out! 看看这个!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM