zoukankan      html  css  js  c++  java
  • Cocoa touch(三):UIResponder

    UIResponder是程序中可响应类的基类,主要提供了与用户交互的一些事件和属性等。firstResponder表示当前与用户交互的控件,常用的方法resignFirstResponder使用控件失去响应。

    @interface UIResponder : NSObject {
      @private
    }
    
    - (UIResponder*)nextResponder;
    
    - (BOOL)canBecomeFirstResponder;    // default is NO
    - (BOOL)becomeFirstResponder;
    
    - (BOOL)canResignFirstResponder;    // default is YES
    - (BOOL)resignFirstResponder;
    
    - (BOOL)isFirstResponder;
    
    // Generally, all responders which do custom touch handling should override all four of these methods.
    // Your responder will receive either touchesEnded:withEvent: or touchesCancelled:withEvent: for each
    // touch it is handling (those touches it received in touchesBegan:withEvent:).
    // *** You must handle cancelled touches to ensure correct behavior in your application.  Failure to
    // do so is very likely to lead to incorrect behavior or crashes.
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
    - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
    
    - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event NS_AVAILABLE_IOS(3_0);
    - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event NS_AVAILABLE_IOS(3_0);
    - (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event NS_AVAILABLE_IOS(3_0);
    
    - (void)remoteControlReceivedWithEvent:(UIEvent *)event NS_AVAILABLE_IOS(4_0);
    
    - (BOOL)canPerformAction:(SEL)action withSender:(id)sender NS_AVAILABLE_IOS(3_0);
    @property(nonatomic,readonly) NSUndoManager *undoManager NS_AVAILABLE_IOS(3_0);
    
    @end
    
    @interface NSObject(UIResponderStandardEditActions)   // these methods are not implemented in NSObject
    
    - (void)cut:(id)sender NS_AVAILABLE_IOS(3_0);
    - (void)copy:(id)sender NS_AVAILABLE_IOS(3_0);
    - (void)paste:(id)sender NS_AVAILABLE_IOS(3_0);
    - (void)select:(id)sender NS_AVAILABLE_IOS(3_0);
    - (void)selectAll:(id)sender NS_AVAILABLE_IOS(3_0);
    - (void)delete:(id)sender NS_AVAILABLE_IOS(3_2);
    - (void)makeTextWritingDirectionLeftToRight:(id)sender NS_AVAILABLE_IOS(5_0);
    - (void)makeTextWritingDirectionRightToLeft:(id)sender NS_AVAILABLE_IOS(5_0);
    - (void)toggleBoldface:(id)sender NS_AVAILABLE_IOS(6_0);
    - (void)toggleItalics:(id)sender NS_AVAILABLE_IOS(6_0);
    - (void)toggleUnderline:(id)sender NS_AVAILABLE_IOS(6_0);
    
    @end
    
    @interface UIResponder (UIResponderInputViewAdditions)
    
    // Called and presented when object becomes first responder.  Goes up the responder chain.
    @property (readonly, retain) UIView *inputView NS_AVAILABLE_IOS(3_2);            
    @property (readonly, retain) UIView *inputAccessoryView NS_AVAILABLE_IOS(3_2); 
    
    // If called while object is first responder, reloads inputView and inputAccessoryView.  Otherwise ignored.
    - (void)reloadInputViews NS_AVAILABLE_IOS(3_2);
    
    @end
  • 相关阅读:
    PAT (Advanced Level) Practice 1100 Mars Numbers (20分)
    PAT (Advanced Level) Practice 1107 Social Clusters (30分) (并查集)
    PAT (Advanced Level) Practice 1105 Spiral Matrix (25分)
    PAT (Advanced Level) Practice 1104 Sum of Number Segments (20分)
    PAT (Advanced Level) Practice 1111 Online Map (30分) (两次迪杰斯特拉混合)
    PAT (Advanced Level) Practice 1110 Complete Binary Tree (25分) (完全二叉树的判断+分享致命婴幼儿错误)
    PAT (Advanced Level) Practice 1109 Group Photo (25分)
    PAT (Advanced Level) Practice 1108 Finding Average (20分)
    P6225 [eJOI2019]异或橙子 树状数组 异或 位运算
    P4124 [CQOI2016]手机号码 数位DP
  • 原文地址:https://www.cnblogs.com/iprogrammer/p/3252506.html
Copyright © 2011-2022 走看看