zoukankan      html  css  js  c++  java
  • iOS应用的入口自定义和事件处理的自定义

    iOS应用的入口自定义和事件处理的自定义

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        MWindow *window = [[MWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        window.backgroundColor = [UIColor yellowColor];
    
        UIStoryboard *SB = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        UIViewController *vc = [SB instantiateInitialViewController];
        self.window = window;
        self.window.rootViewController = vc;
        [self.window makeKeyAndVisible];
    
        return YES;
    }
    

    这些方法的实现,可以实现事件处理者的自定义

    //找到事件的处理者  Application ---->window---->fitView(先判定点在不在view里面,再去判定方法)
    - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
    {
    // return [super hitTest:point withEvent:event];
        return self;
    }
    //判断点击点是不是在当前的响应者中
    - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
    {
     return YES;
    }
    
    - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
    {
        NSLog(@"%s",__func__);
    }
    
  • 相关阅读:
    阻止默认事件和冒泡
    js获取元素相对窗口位置
    ios中safari浏览器中date问题
    模拟单选框,多选框
    vue
    js合并两个对象的方法
    oracle 序列
    Oracle生成随机数大全
    JAVA基础面试题
    网速计算
  • 原文地址:https://www.cnblogs.com/fuunnyy/p/5797566.html
Copyright © 2011-2022 走看看