码迷,mamicode.com
首页 > 其他好文 > 详细

[Stanford 2011] segue

时间:2014-12-03 00:10:51      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   sp   for   strong   on   

From:view 6(00:17)

Knowledge Points:

1. The segue is the thing that made it so that it moved over to the other MVC.

2. How the segue gets set up?

    To create a segue,you hold down ctrl and drag from the button to the other View Controller.

    Segues always instantiate a view controller.You never segue to an existing view controller,one that‘s already sitting in the heap. Segues create a new view controller,always. And they do this because, thatis the model we want for memory management. We want MVCs to get created when they go on screen. And then when they go off-screen, unless there‘s back button that might go to them,they go away. And then if you were to press the graph button again they get recreated, so view controllers are somewhat ephemeral alright. They come into existence they‘re used on screen, and when they go off screen a lot of times they‘ll just go away. And that keeps the memory usage for our app low.

two important properties are (1)The identifier. That gives a name to this segue.And the reasons we want the name:One, in our code we can say, go do this segue,by name. Specify the name of a segue, it‘ll go do it. And also, when segues happen, we get to get involved, maybe preparing this newly created view controller beyond screen. And we identify what to do to prepare it by the name,the segue. So it‘s important to know the name of this segue.(2)The style. There‘s different styles of segues. "push style" means it‘s in a navigation controller.

3. How we create a UINavigationController in our storyboard(putting the segue into the navigationController)?

We‘ve defined the segue between them, then we should put them inside navigation controller.

Tip: If you double click on the background of your storyboard, it‘ll zoom out to show you more. Which you really need when you start building your whole app, and multiple MVCs, all segueing into each other. You wanna be able to see the whole thing, and so you can zoom out. You can also zoom out with these little things down on the bottom.

The arrow that‘s going into that view controller means that this is where the application starts. You can pick that arrow up with the mouse in Xcode to move it to another control. Or you can use a little switch in the Inspector in the right side. That says initial scene.

How we get this thing in navigation controller?  ans:  Xcode | Editor | Embed in | Navigation Controller, so another view controller‘s going to appear, a navigation controller. Notice that it‘s going to keep the arrow, it moves the arrow to itself. and Then it has a little pointer right after it,which is not a segue. This little pointer in between is a special little connection in Xcode, which is the rootViewController outlet of the UINavigationController. (The navigation controller have a pointer to the root view controller that‘s the first MVC that they display. So that‘s what the little thing is. )

bubuko.com,布布扣

 UINavigationController is as bellow:

bubuko.com,布布扣

[Stanford 2011] segue

标签:style   blog   http   io   ar   sp   for   strong   on   

原文地址:http://www.cnblogs.com/Xylophone/p/4138725.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!