• iOS-transform属性


    //
    //  ViewController.m
    //  transform属性
    //
    //  Created by YaguangZhu on 15/7/29.
    //  Copyright (c) 2015年 YaguangZhu. All rights reserved.
    //
    
    #import "ViewController.h"
    
    @interface ViewController ()
    @property (weak, nonatomic) IBOutlet UIButton *btnIcon;
    - (IBAction)move;
    
    - (IBAction)rotate:(UIButton *)sender;
    - (IBAction)scale;
    - (IBAction)reset;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    - (void)didReceiveMemoryWarning {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    
    - (IBAction)move {
        
        //CGAffineTransform  transform =self.btnIcon.transform;
       // self.btnIcon.transform = CGAffineTransformMakeTranslation(0, -50);
        self.btnIcon.transform = CGAffineTransformTranslate(self.btnIcon.transform, 0, 50);
    }
    
    - (IBAction)rotate:(UIButton *)sender {
       // self.btnIcon.transform = CGAffineTransformMakeRotation(40);
        self.btnIcon.transform =CGAffineTransformRotate(self.btnIcon.transform, 40);
    
    }
    
    - (IBAction)scale {
        //self.btnIcon.transform = CGAffineTransformMakeScale(1.5, 1.5);
        
        [UIView animateWithDuration:2.5 animations:^{
            self.btnIcon.transform = CGAffineTransformScale(self.btnIcon.transform, 1.5, 1.5);
        
         }];
    }
    
    - (IBAction)reset {
        self.btnIcon.transform = CGAffineTransformIdentity;

    //控制里面所有控件
    for (UIView *view in  self.view.subviews) {
    
    

            view.backgroundColor = [UIColor redColor];

    
    

        }

    //控制父控件 

    self.btnIcon.superview.backgroundColor = [UIColor redColor];

     

    //根据tag获取控件


    //删除所有控件

     while (self.view.subviews.firstObject) {

    
    

            [self.view.subviews.firstObject removeFromSuperview];

    
    

        }


    }
    @end
  • 相关阅读:
    使用jetty部署配置solr服务
    solr 与 MySQL(二)
    学习solr(一)
    FormData 上传文件
    node.js cannot find module 'mysql'
    select2 ajax 无法选中
    jenkins持续集成文件冲突的问题
    Inno Setup 实现每次jenkins自动构建时版本号自动+1
    jenkins 配置slave节点(win10系统)
    Jenkins+Gradle实现android开发持续集成和打包
  • 原文地址:https://www.cnblogs.com/zhuyaguang/p/4686122.html
Copyright © 2020-2023  润新知