UIResponder详解
来源:互联网 发布:数控机床如何编程 编辑:程序博客网 时间:2024/06/06 03:12
转自:强哥达人
UIResponder Class Reference
Managing the Responder Chain
- 1.-
(UIResponder *)nextResponder
UIResponder类不自动存储和设置下一个响应者,而是默认返回nil。子类必须override这个方法来设置下一个响应者。
UIView实现了这个方法,因为可以返回管理这个UIView的UIViewController或者它的父类;
UIViewController实现了这个方法,返回UIViewController的View的父View;
UIWindow发挥UIApplication对象;
UIApplication返回nil
- 2.-
(BOOL)isFirstResponder
- 3.-
(BOOL)canBecomeFirstResponder
如果一个响应对象通过这个方法返回YES,那么它成为了第一响应对象,并且可以接收触摸事件和动作消息。
子类必须overrider这个方法才可以成为第一响应者。
You must not send this message to a view that is not currently attached to the view hierarchy. The result is undefined.
- 3.-
(BOOL)becomeFirstResponder
子类可以override这个方法来更新状态或者执行一些行为,比如高亮选中项。
一个响应对象只有当前响应者可以放弃第一响应者状态,并且新的响应者可以成为第一响应者,才能成为第一响应对象。
- 4.-
(BOOL)canResignFirstResponder
- 5.-
(BOOL)resignFirstResponder
如果返回NO,拒绝放弃第一响应状态。
如果你override这个方法,必须调用父类的实现[super resignFirstResponder].
Managing Input Views
- 1.@property
(readonly, retain) UIView *inputView
This property is typically used to replace the system-supplied keyboard that is presented for
UITextField和UITextView如果设置了inputView那么在becomeFirstResponder时不会显示键盘,而现实自定义的inputView;如果设置了inputAccessoryView那么在becomeFirstResponder时会在键盘的顶端显示自定义的inputAccessoryView。
- 2.@property
(readonly, retain) UIView *inputAccessoryView
This property is typically used to attach an accessory view to the system-supplied keyboard that is presented forUITextField
- 3.-
(void)reloadInputViews
Responding to Touch Events
- 1.-
(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
将消息转发给下一个响应者,将消息发送给父类,不要将消息直接传递给下一个响应者。
如果你override这个方法而没有调用super..,你必须同样override其它响应触摸事件的方法,你要是空实现就好。
默认是不支持多点触摸的,如果想要响应多点触摸,你只要吧UIView的
- 2.-
(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
- 3.-
(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
- 4.-
(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
Responding to Motion Events
- 1.-
(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
- 2.-
(void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
- 3.-
(void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event
Responding to Remote-Control Events
- 1.-
(void)remoteControlReceivedWit hEvent:(UIEvent *)event
Getting the Undo Manager
- 1.@property(readonly)
NSUndoManager *undoManager
Validating Commands
- 1.-
(BOOL)canPerformAction:(SEL)action withSender:(id)sender
YES
- UIResponder详解
- UIResponder详解
- UIResponder 详解
- UIResponder详解
- UIResponder详解
- UIResponder 对象详解
- UIResponder使用详解
- UIResponder 对象详解
- UIResponder类详解
- UIResponder详解(响应者)
- UIResponder详解(响应者)
- ios开发 之 UIResponder详解
- UIResponder
- UIResponder
- UIResponder
- UIResponder
- UIResponder
- UIResponder
- oracle 存储过程的输出
- Combining SqlConnection and SqlCommand in one Class in C#
- IntelliJ IDEA 快捷键和设置
- WebBrowser用法总结
- click 与 jsClick
- UIResponder详解
- android登录Web以及登录保持、cookie管理相关
- 字符串的排列(去除重复项)
- GCD介绍
- Unicode的C/C++编程
- public static void main(String[] args)的理解!
- mini2440-openwrt启动信息
- php jpgraph 字体设置
- 回收内核空间资源 wait函数 waitpid函数