本文共 1196 字,大约阅读时间需要 3 分钟。
1、- (void)becomeKeyWindow; // override point for subclass. Do not call directly 调用窗口,使之变成关键窗口 2、- (void)resignKeyWindow; // override point for subclass. Do not call directly 调用窗口,使之取消关键窗口
3、- (void)makeKeyWindow; 使之成为主窗口
4、- (void)makeKeyAndVisible; // convenience. most apps call this to show the main window and also make it key. otherwise use view hidden property 使之成为主窗口,并且显示
5、- (void)sendEvent:(UIEvent *)event; // called by UIApplication to dispatch events to views inside the window 事件拦截分发到指定视图对象
当用户发起一个事件,比如触摸屏幕或者晃动设备,系统产生一个事件,同时投递给UIApplication,而UIApplication则将这个事件传递给特定的UIWindow进行处理(正常情况都一个程序都只有一个UIWindow),然后由UIWindow将这个事件传递给
特定的对象(即first responder)
并通过响应链进行处理。虽然都是通过响应链对事件进行处理,但是触摸事件和运动事件在处理上有着明显的不同(主要体现在确定哪个对象才是他们的first responder):
窗口坐标系统转化
6、- (CGPoint)convertPoint:(CGPoint)point toWindow:(UIWindow *)window; // can be used to convert to another window 转化当前窗口一个坐标相对另外一个窗口的坐标
7、- (CGPoint)convertPoint:(CGPoint)point fromWindow:(UIWindow *)window; // pass in nil to mean screen 转化另外窗口一个坐标相对于当前窗口的坐标
8、- (CGRect)convertRect:(CGRect)rect toWindow:(UIWindow *)window; 转化当前窗口一个矩形坐标相对另外一个窗口的坐标
9、- (CGRect)convertRect:(CGRect)rect fromWindow:(UIWindow *)window; 转化另外窗口一个矩形坐标相对于当前窗口的坐标
转载地址:http://sqgbn.baihongyu.com/