• 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
  • 相关阅读:
    Android 调用已安装市场,进行软件评分的功能实现
    二十六个月Android学习工作总结
    Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1) 错误 解决方案(android-ndk)
    【Android】神奇的android:clipChildren属性
    Android利用setLayoutParams在代码中调整布局(Margin和居中)
    android 使用代码实现 RelativeLayout布局
    Android 布局学习
    Erlang cowboy 处理不规范的client
    HTTP 响应
    把字符串转换为整数
  • 原文地址:https://www.cnblogs.com/iprogrammer/p/3252506.html
Copyright © 2020-2023  润新知