如果要查看内部,nib文件到底是什么样的? [英] What exactly does a nib file look like if you were to look inside?

查看:124
本文介绍了如果要查看内部,nib文件到底是什么样的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是在学习笔尖和速度,并对某些东西感到好奇.我知道,如果您有一个main.storyboard文件,则首先在根视图控制器中加载了一个笔尖,然后对于该视图控制器下可能存在的任何视图,但是...我想知道.

I'm just learning about nibs and swift and am curious about something. I know that if you have a main.storyboard file, that a nib is loaded first fir the root view controller, then for any views that may exist hierarchically under that view controller, however... I'm wondering something.

当他们说笔尖已被加载"时,这是否意味着基于您在界面构建器中构建的情节提要,一个函数可以调用您要加载的ui对象的实例?

When they say a nib is 'loaded' does that mean that, a single function CALLS instances of the ui objects that you would like to load, based on the storyboard that you have built in the interface builder?

如果没有,那么看待这个问题的正确方法是什么?我正在尝试收集一个简单易懂,准确的事件发生的心理模型.

If not, what is the right way of looking at this? I'm trying to collect an easy to understand, accurate mental model of what happens.

谢谢!

推荐答案

如果要查看内部,nib文件到底是什么样的?

What exactly does a nib file look like if you were to look inside?

直接向前看,看看!它只是一个XML文件.完全可读的人.

Go right ahead and look inside and see! It's just an XML file; perfectly readable by a human.

我知道,如果您有一个main.storyboard文件,则首先在根视图控制器中加载了一个笔尖,然后是该视图控制器下可能分层存在的任何视图

I know that if you have a main.storyboard file, that a nib is loaded first fir the root view controller, then for any views that may exist hierarchically under that view controller

正确!更准确地说,将故事板中的每个场景"想象成由两个笔尖组成,其中一个包含视图控制器,另一个包含其视图,视图的子视图以及构成该场景的所有其他内容. /p>

Correct! To be more precise, think of every "scene" in the storyboard as comprising two nibs, one containing the view controller, the other containing its view, the view's subviews, and everything else constituting that scene.

当他们说笔尖已被加载"时,这是否意味着基于您在界面构建器中构建的情节提要,一个函数可以调用您要加载的ui对象的实例?

When they say a nib is 'loaded' does that mean that, a single function CALLS instances of the ui objects that you would like to load, based on the storyboard that you have built in the interface builder?

将笔尖视为一堆潜在的对象实例.加载笔尖会将那些潜在的对象变成 actual 实例.因此,加载笔尖只是实例化和配置对象的另一种方法.笔尖被加载"只是意味着读取该笔尖,并实例化并检索其描述的对象.这就是为什么您可以多次加载同一笔尖以获取这些对象的多个实例的原因.

Think a nib as just a bunch of potential object instances. Loading the nib turns those potential objects into actual instances. Loading a nib is thus just another way of instantiating and configuring objects. A nib being "loaded" simply means that the nib is read and the objects it describes are instantiated and retrieved. That is why you can load the same nib multiple times to get multiple instances of those objects.

这篇关于如果要查看内部,nib文件到底是什么样的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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