zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    低级错误之Hbm中类型不一致错误
    低级错误之Oracle客户端添加数据
    低级错误之页面中action的请求地址与action中写的requsetmapping不一致
    低级错误之删除存在关联的表报错
    低级错误之方法自调陷入死循环
    Notepad++的一些常用的快捷键
    [css]inline-block
    框架开发之Java注解的妙用
    面试必备【含答案】Java面试题系列(二
    Kotlin:数组、字符串模板
  • 原文地址:https://www.cnblogs.com/welhzh/p/4319465.html
Copyright © 2011-2022 走看看