zoukankan      html  css  js  c++  java
  • ios学习记录 day27 UI 5 事件处理

    事件概述

    UIEvent:事件,是由硬件捕捉的一个表示用户操作设备的对象

    分三类:触摸 晃动 远程控制

    触摸事件:会包含一个到多个UITouch        Began Move End

    UITouch概述

    UIView支持触摸 ,而且支持多点(UIView继承UIResponder)

    需要定义UIView子类,实现触摸相关方法  实现touches...began  touches...move  touches...end  touches...cancelled方法(记录手指坐标)

                                                         当触摸序列被诸如电话呼入这样的系统事件所取消时,发送touchesCancelled:withEvent:消息。

    重写drawRect:

    添加撤销按钮

    对数组字典的复习

    .h

    @property (nonatomic, retain) NSMutableArray *bigArray;

    //    NSArray * arr = [NSArray arrayWithObjects:@"aa",@"bb",@"cc",@"dd",@"ee", nil];
    //    
    //    NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:@"object",@"key",@"object1",@"key1", nil];
    //    NSDictionary *dic1 = [NSDictionary dictionaryWithObjectsAndKeys:arr,@"arr", nil];
    //    
    //    NSArray * dicObjects = [NSArray arrayWithObjects:arr, nil];
    //    NSArray * names = [NSArray arrayWithObjects:@"arr", nil];
    //    NSDictionary *dic2 = [NSDictionary dictionaryWithObjects:dicObjects forKeys:names];
    //    NSArray *a = [dic2 objectForKey:@"arr"];
    //    NSLog(@"a == %@",a);
        
        self.bigArray = [NSMutableArray array];
        NSLog(@"big array1 == %@",_bigArray);
        
        NSMutableDictionary *dic = [NSMutableDictionary dictionary];
        NSLog(@"dic == %@",dic);
        
        [dic setObject:[UIColor redColor] forKey:@"color"];
        NSLog(@"%@",dic);
        
        NSMutableArray * arr = [NSMutableArray array];
        [arr addObject:@"+"];
        
        [dic setObject:arr forKey:@"array"];
        NSLog(@"dic == %@",dic);
        
        [_bigArray addObject:dic];
        NSLog(@"bigArray2 == %@",_bigArray);
        [self insertIntoDic];
    }

    - (void)insertIntoDic//向字典中添加内容
    {
        for (NSMutableDictionary *dic in _bigArray) {
            NSMutableArray * array = [dic objectForKey:@"array"];
            [array addObject:@"hello"];
            NSLog(@"bigArray3 == %@",_bigArray);
        }
    }

  • 相关阅读:
    手把手教NIS Edit安装向导的使用
    使用HM NIS Edit制作软件安装包
    有哪些适合学习英语的纪录片 ?
    Android入门(一)AndroidStudio下的APP目录结构介绍
    架构和框架的区别
    Git版本控制的快捷方式(GITCHEAT SHEET)
    DOS下启动MySQL时输入net start mysql 提示服务名无效的问题
    个人搜查小问题
    oozie说明(本文参考多处,自己留看)
    oozie fork join结点
  • 原文地址:https://www.cnblogs.com/lxllanou/p/3652787.html
Copyright © 2011-2022 走看看