The File's Owner

The File Owner is an instantiated, runtime object that owns the contents of your nib and its outlets/actions when the nib is loaded. It can be an instance of any class you like - take a look at the identity tab of the tool palette.

For example, consider you have a UIViewController subclass with an IBOutlet for a UILabel. In interface builder the File‘s owner will be set to the same class as your UIViewController. When your nib is loaded at runtime, the bindings of outlets and actions defined in your nib are bound to the instance of your view controller, as your view controller is the owner.

Nibs are loaded using:

[[NSBundle mainBundle] loadNibNamed:@"NibName" owner:nil options:nil];

The owner parameter is particularly important. That‘s the runtime instance of a class that owns the contents (outlets, actions and objects) of the nib being loaded.

Hopefully that‘s clear. To see this at work create a brand new iPhone project with a view controller. Open the Nib file and take a look at the identity tab.

First responder is simply the first object in the responder chain that can respond to events. The responder chain is a runtime collection (or more accurately a hierarchy) of objects that can respond to an event. For example, consider you have a window with a view and on that view is a text field.

If that text field has focus it‘s known as the first responder in the chain. So if you send a message to the first responder it‘ll be sent to the text field first. If the text field can‘t handle the message it‘ll be sent to the next responder. And the next. And the next, until you get to the end of the responder chain or something has consumed the event (iirc).

The responder chain is worth reading about - hit apple‘s documentation for more information.

The File's Owner

时间: 2025-02-01 19:51:40

The File's Owner的相关文章

[转]ios 开发file's owner以及outlet与连线的理解

转载地址:http://www.cocoachina.com/bbs/simple/?t108822.html xib文件本身可以看做是一个xml,app启动的时候会根据xml构造xib对应的界面及其控件, file's owner 可以看做是 xib对应的类,比如 view对应的xib文件的file'owner对应的就是 viewcontrol的类, outlet是针对xib文件中希望能够在外部引用的控件成员,那么为什么要做outlet与file's owner 之间的连线呢?这里file's

【iOS】Xib的使用与File'Owner总结

一.XIB的适用范围 xib(也叫Nib)与storyboard一样是用来描写叙述界面的. storyboard描写叙述的是比較大型的,大范围.适合描写叙述界面跳转等. 二.XIB的使用 Xib是小范围的的,是轻量级的.比較适合描写叙述小块的界面. 创建xib:新建界面里面user interface -->empty. 载入xib:[NSBundle mainBudle]loadNibNamed:XXX-.]来载入xib 三.关于loadNibNameed方法 [[NSBundle mainB

【iOS】Xib的使用与File'Owner总结

一.XIB的适用范围 xib(也叫Nib)与storyboard一样是用来描述界面的. storyboard描述的是比较大型的,大范围.适合描述界面跳转等. 二.XIB的使用 Xib是小范围的的,是轻量级的.比较适合描述小块的界面. 创建xib:新建界面里面user interface -->empty. 加载xib:[NSBundle mainBudle]loadNibNamed:XXX-.]来加载xib 三.关于loadNibNameed方法 [[NSBundle mainBundle] l

开发进阶09_xib文件的基本使用_File's Owner

storyboard:描述软件界面,大范围,重量级,比较适合描述整个软件的所有界面 xib:描述软件界面,小范围,轻量级,比较适合描述某个小界面 两个各有优缺点 //1.加载RowView.xib NSArray *views = [[NSBundle mainBundle] loadNibNamed:@"RowView” owner:self options:nil]; loadNibNamed:从资源中读取xib文件 如果想通过连线的方式去调用头文件中的方法,需要给xib文件设置File’s

【Ruby】File 类和方法

阅读目录 类方法 实例方法 File 表示一个连接到普通文件的 stdio 对象.open 为普通文件返回该类的一个实例. 类方法 序号 方法 & 描述 1 File::atime( path)返回 path 的最后访问时间. 2 File::basename( path[, suffix])返回 path 末尾的文件名.如果指定了 suffix,则它会从文件名末尾被删除.例如:File.basename("/home/users/bin/ruby.exe") #=> &

一起来学linux:ACL

p { margin-bottom: 0.25cm; line-height: 120% } 传统的 权限设置只有user,group,other三种,并没有办法针对某一个用户或者某一个组来设定权限.ACL就是用于这个目的的 那 ACL 主要可以针对哪些方面来控制权限呢?他主要可以针对几个项目: 使用者 (user):可以针对使用者来配置权限: 群组 (group):针对群组为对象来配置其权限: 默认属性 (mask):还可以针对在该目录下在创建新文件/目录时,规范新数据的默认权限: 查看系统是

七:HDFS Permissions Guide 权限

1.权限模式     简单:启动HDFS的操作系统用户即为超级用户,可以通过HADOOP_USER_NAME指定 kerberos: 2.group mapping 组列表由group mapping service完成,该服务由hadoop.security.group.mapping参数决定,默认值是org.apache.hadoop.security.JniBasedUnixGroupsMappingWithFallback,即由JNI. 如果没有JNI, 使用org.apache.had

iOS -MVC

MVC简介: (1) MVC是一种设计模式 (2) 所谓设计模式就是解决某一问题的方案. (3) MVC是解决具有UI应用系统的成熟解决方案,在Cocoa应用系统中严格按照该模式实现. Model: 应用系统中与视图相关的部分数据 View:应用系统中用户看到并与之交互的界面 Controller:应用系统中起到控制器作用,接受用户事件,显示数据等等,与视图进行交互等 2.1 File's owner(文件的所有者,指nib文件) File's owner即ViewController

浅析Linux系统下用户与权限管理

Linux作为一种多用户多任务操作系统,在日常的使用中不可避免地要划分出一个角色的概念来管理和使用计算机,这个角色与每一个计算机使用者关联,在Linux中称这种角色为用户.而在每一个用户使用计算机的过程中,又必然存在对有限计算机资源使用的限制性,那么操作系统就必须提供一种途径来保证每个用户独立.合理的使用计算机. 一.用户和用户组管理   (一)用户及用户组相关基本概念  用户:泛指计算机的使用者.用计算机可识别的用户ID(UID,user id)标识. 用户组:用户容器,用来将多个用户合并为一