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
  • 相关阅读:
    .Uva&LA部分题目代码
    历史遗留问题列表
    hdu5681 zxa and wifi
    算法心得2:关于k个最小和问题的思考
    算法心得1:由$nlogn$复杂度的LIS算法引起的思考
    Codeforces Round #336 Marbles
    HDU 2571 命运
    POJ 3630 && HDU 1671 Phone list(静态字典树)
    静态字典树和动态字典树模板
    双向广搜
  • 原文地址:https://www.cnblogs.com/zhuyaguang/p/4686122.html
Copyright © 2011-2022 走看看