zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    HDU 1312 Red and Black DFS(深度优先搜索) 和 BFS(广度优先搜索)
    HDU 1241 Oil Deposits DFS(深度优先搜索) 和 BFS(广度优先搜索)
    邮件推广工具
    aix-syslog
    能量点
    知识picture
    C中运算符
    stdio.h头文件中申明的基本函数
    字符串
    指针字符串
  • 原文地址:https://www.cnblogs.com/zhuyaguang/p/4686122.html
Copyright © 2011-2022 走看看