zoukankan      html  css  js  c++  java
  • 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];
    

      

      

  • 相关阅读:
    定义和使用EL函数
    在Java Web程序中使用Hibernate
    JDBC在Java Web中的应用——分页查询
    JDBC调用存储过程
    使用navicat工具创建MySQL存储过程
    JDBC操作数据库的批处理
    JDBC操作数据库
    Servlet监听器统计在线人数
    Servlet字符编码过滤器
    Servlet过滤器创建与配置
  • 原文地址:https://www.cnblogs.com/lihaozhou/p/4331015.html
Copyright © 2011-2022 走看看