• UI05-‍手势用图片做实验


    /*今日任务:

     1.设计模式: 怎么去实现,两种 2.imageview 图片显示3.手势用图片做实验

     1.设计模式:设计模式的作用:(1)提高代码的可扩展性 (2)提高代码的可读性 偶合度是判断代码优秀的标准。

       设计模式和代码的结合。第一个是taget/action 模式

     2.pch 全局

     作业:完善出自己的button,view好lable组合出button ,.

    - (void)viewDidLoad {

        [super viewDidLoad];

        UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapGesture:)];

        [_mainv.swip addGestureRecognizer:tap];

            UILongPressGestureRecognizer *longpress=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(LongPress:)];

        longpress.minimumPressDuration=1.0;

        [_mainv.longpress  addGestureRecognizer:longpress];

            UISwipeGestureRecognizer *swip=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipGesture:)];

        [_mainv.longpress addGestureRecognizer:swip];

            UIPanGestureRecognizer *pan=[[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(panGestureRecognizer:)];

        [_mainv.longpress addGestureRecognizer:pan];

          UIPinchGestureRecognizer *pinch=[[UIPinchGestureRecognizer alloc]initWithTarget:self action:@selector(pinchGestureRecognizer:)];

        [_mainv addGestureRecognizer:pinch];

           UIRotationGestureRecognizer *roatation=[[UIRotationGestureRecognizer alloc]initWithTarget:self action:@selector(rotationGesture:)];

        [_mainv addGestureRecognizer:roatation];

    }

    -(void)rotationGesture:(UIRotationGestureRecognizer *)rotation{

        rotation.view.transform=CGAffineTransformMakeRotation(rotation.rotation);

    }

     -(void)pinchGestureRecognizer:(UIPinchGestureRecognizer*)pinch{

         pinch.view.transform=CGAffineTransformMakeScale(pinch.scale, pinch.scale);

     }

     -(void)panGestureRecognizer:(UIPanGestureRecognizer *)pan{

         CGPoint offsite=[pan translationInView:self.view];

        pan.view.transform=CGAffineTransformMakeTranslation(offsite.x, offsite.y);

     }

     -(void)swipGesture:(UISwipeGestureRecognizer*)swip{

         swip.direction=UISwipeGestureRecognizerDirectionLeft;

    }

     -(void)LongPress:(UILongPressGestureRecognizer *)longpress{

           if (longpress.state==UIGestureRecognizerStateBegan ) {

            longpress.view.backgroundColor=[UIColor colorWithRed:arc4random()%256/255.0 green:arc4random()%256/255.0  blue:arc4random()%256/255.0  alpha:1.0];

        }

    }

    -(void)tapGesture:(UITapGestureRecognizer *)taptap{

         taptap.view.backgroundColor=[UIColor colorWithRed:arc4random()%256/255.0 green:arc4random()%256/255.0  blue:arc4random()%256/255.0  alpha:1.0];

        taptap.numberOfTapsRequired=2.0;

    //    taptap.numberOfTouchesRequired=2;

        }

  • 相关阅读:
    Spring -- 自定义转换器
    Spring乱码问题解决方案
    Spring 声明式事务
    Spring -- IOC
    Spring--入门
    mybatis 二级缓存
    Mybatis 缓存失效的几种情况
    MyBatis深入浅出--入门
    【RF库Collections测试】Get From Dictionary
    【RF库Collections测试】Get Dictionary Values
  • 原文地址:https://www.cnblogs.com/ytmaylover/p/5049242.html
Copyright © 2020-2023  润新知