XcCode5:关系如何与界面生成器一起使用? [英] XcCode5: How do relationships work with interface builder?

查看:84
本文介绍了XcCode5:关系如何与界面生成器一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在故事板中,我试图让视图/控制器彼此成为父母/孩子,尽管我不知道这是否可能.

In storyboard I'm trying to do let views/controllers become parents/children from each other, although I don't know if this is possible.

视图控制器可以具有子视图控制器,因此我想在视图上强制使用相同的结构.这可能吗?

The view controllers can have child view controllers, so I want to enforce the same structure on the views. Is this possible?

例如,假设存在ParentViewControllerChildViewController(它们是UIViewControllers).然后是相应的ParentViewChildView(它们是UIView).

For example, say there is ParentViewController and ChildViewController (which are UIViewControllers). And then there's the corresponding ParentView and ChildView (which are UIView).

我在中心的ParentView(和ParentViewController)中指定了UIImageView IBOutlet *imageView,并带有一些尺寸(例如,视图为400 x 400).

I specify a UIImageView IBOutlet *imageView in ParentView (and ParentViewController) right in the center, with some dimensions (e.g. the view is 400 by 400).

我所知道的是ChildViewController能够访问ParentViewController中的属性.但是我还可以通过ParentView的某种机制使ChildView连接到该插座吗?情节提要中似乎没有拖动机制".

What I do know is that ChildViewController is able to access the property in the ParentViewController. But can I also make ChildView connect to that outlet by some kind of mechanism from ParentView? There doesn't seem to be a "dragging mechanism" in Storyboard.

我调查了诸如这些问题,但他们没有有了答案,因为它有些过时了(又有些不同).

I looked into questions like these, but they do not have the answer, because it's partially outdated (and partially different).

推荐答案

Melvin,这可能是...

Melvin, it's possible this ...

https://stackoverflow.com/a/23403979/294884

是您追求的.现在一切都变成了容器...

is what you're after. Everything's a container now ...

请注意,在底部我提到了顺便说一句"让孩子获得视图控制器的两种方法,就像现代iOS编程中最重要的事情!".呵呵. (在iOS文档中令人惊讶地做出了非常糟糕的解释.)

note, at the bottom there I mention "in passing" the two methods for getting at child the view controllers, it's like "the most important thing in modern iOS programming!" heh. (Staggeringly badly explained in the iOS docs.)

.

再说一遍,苹果公司从来没有提到过"是完全奇怪的-除了最简单的应用程序以外,它几乎是制作其他任何东西时的核心概念.

To repeat, it's totally bizarre that Apple sort of "never mentions this" - it's pretty much the core concept in making anything other than the simplest apps.

在这个新的容器驱动的世界中,一切都变得非常简单(一旦它们被钩在一起!)

Everything is amazingly easy in this new container-driven world (once they are hooked together!)

希望我能理解你的问题,干杯!

Hope I understood your question, cheers!

这篇关于XcCode5:关系如何与界面生成器一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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