zoukankan      html  css  js  c++  java
  • firstResponder

    https://developer.apple.com/library/content/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/DirectingInputtoaSpecificResponder.html#//apple_ref/doc/uid/TP40009541-CH12-SW1

     

    Directing Input to a Specific Responder

    Touch events are automatically dispatched to the view in which they occurred, but most other events are directed to the object designated as the first responder. You can also set the first responder programmatically to any of your app’s responder objects. User interactions may also cause a view to become the first responder automatically, but only if it wants to be the first responder. For example, tapping a text field causes the text field to become the first responder, but tapping a button triggers the button’s action and does not cause it to become the first responder. 

    When an object becomes the first responder, UIKit displays the input view associated with that responder. An input view is a custom interface that you can use to gather information. The system keyboard is an example of an input view. 

    Programmatically Changing the First Responder

    To designate an object as the first responder, call its becomeFirstResponder method. UIKit makes the object the first responder only if the following conditions are met:

    • The current first responder’s canResignFirstResponder property returns YES.

    • The new responder’s canBecomeFirstResponder property returns YES. (The default implementation of this property returns NO, so you must override it to allow your object to become the first responder.) 

    Most responder objects resign the first responder status readily, but you can return NO as needed from the canResignFirstResponder property. For example, you might return NO to prevent your custom control from resigning as first responder while it contains invalid data. 

  • 相关阅读:
    Verilog之阻塞赋值非阻塞赋值
    Verilog之case语句
    Verilog 分频器
    kvm虚拟化存储管理(3)
    kvm虚拟机管理(2)
    Kvm 虚拟化介绍(1)
    云计算 大数据 人工智能
    openstack核心组件——cinder存储服务(11)
    openstack核心组件——horizon Web管理界面(10)
    openstack核心组件——neutron网络服务 抓取ip(9)
  • 原文地址:https://www.cnblogs.com/feng9exe/p/7047896.html
Copyright © 2011-2022 走看看