• Day1


    1  CGRect frame

    控件所在矩形框在父控件中的位置和尺寸(以父控件的左上角为坐标原点)

    可以定义控件的位置(origin)和大小(size)

    2 CGRect bounds 

    控件所在矩形框的位置和尺寸(以自己左上角为坐标原点,所以Bounds的x,y一般为0)

    可以定义控件的大小(size)

    3 CGRect center 

    控件中点的位置(以父控件的左上角为坐标原点)

    可以定义控件的位置(center)

    4 enum 结构

    typedef enum
    {
        kMovingDirTop=10,
        kMovingDirRight,
        kMovingDirButtom,
        kMovingDirLeft
    } kMovingDir;
    

      

    5 define 宏定义

    #define kmovingDelta 20
    

    6 私有属性

    @interface ViewController ()
    //私有属性和方法
    @property (weak, nonatomic) IBOutlet UIButton *headImageView;
    
    @end
    
    @implementation ViewController
    
    @end
    

    7 button事件

    //系统产生的方式
    - (IBAction)move:(id)sender 
    {
    }
    //可改成 , 这样便可拥有button的属性 ,例如tag之类的去区分不同的按钮
    - (IBAction)move:(UIButton *)button 
    {
      //button.tag          
    }
    

    8 Animation

    CGRect rect = self.headImageView.frame;
    rect.origin.y -=20;
    //beginAnimtions 和commitAnimations之间的代码执行动画
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.0];
    self.headImageView.frame = rect;
    [UIView commitAnimations];
    

    9 button 状态

     Default Highlighted selected disabled 4种状态,每个状态都有自己的属性可以设置

    10 转义

    //string 转 int
    int result = str1.intValue
    
    //int 转 string
    self.sumLabel.text = [NSString stringWithFormat:@"%d",result];
    

    11 键盘事件

    //收起键盘
    [self.num1 resignFirstResponder];
    

    12 transform : translate tranform rotate

    //Translate
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:1.0];
        self.headImageView.transform = CGAffineTransformTranslate(self.headImageView.transform, 0, -20);
        [UIView commitAnimations];
    
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:2.0];
        
        //self.headImageView.transform = CGAffineTransformScale(self.headImageView.transform, 1.3, 1.3);
        self.headImageView.transform = CGAffineTransformRotate(self.headImageView.transform, M_PI_4);
    
        [UIView commitAnimations];
    

      

      

  • 相关阅读:
    【Android
    梦想责任与团队
    在MySQL字段中使用逗号分隔符
    session_write_close() 用法
    课程-问题分析与解决
    团队管理:新业务团队如何结合绩效来度量开发目标
    Linux sort 排序 去重 统计
    nginx-404与fastcgi_intercept_errors指令
    nginx fastcgi_buffers to an upstream response is buffered to a temporary file
    10年软件开发中获得的最宝贵的经验!非常值得你一读
  • 原文地址:https://www.cnblogs.com/lihaozhou/p/4331015.html
Copyright © 2020-2023  润新知