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__);
    }
    
  • 相关阅读:
    POJ 3093 Margaritas on the River Walk(背包)
    BZOJ 2287 【POJ Challenge】消失之物(DP+容斥)
    WC2017 Day1
    WC2017 Day0
    WC2017 Conclusion
    WC2017 Day6
    UOJ #58 糖果公园
    WC2017 Day5
    codevs 1946 阿狸的打字机
    HDU 2457 DNA_repair
  • 原文地址:https://www.cnblogs.com/fuunnyy/p/5797566.html
Copyright © 2011-2022 走看看