• objectivec 常用的一些控件。


    /***********UIButton***************/
    //新建button  UIButtonTypeCustom为隐藏按键  UIButtonTypeRoundedRect 为显示
     UIButton * testbutton = [UIButton buttonWithType:UIButtonTypeCustom];
    
    //设置button的文字显示
     [testbutton setTitle:@"显示"  forState:UIControlStateNormal];
    
    //为按键添加事件
     [testbutton addTarget:self action:@selector(exitselview:) forControlEvents:UIControlEventTouchUpInside];

    //如果一次需要设多个button可用for 循环创建.........可给相应的button设一个tag值。方便事件调用的时候用。
    testbutton.tag = 0;
    
    //在事件中可与相应的button 关联 判断
    if( ((UIButton*)sender).tag ==N)
    {
         ......
    }
    else
    {
        .......
    }
     
    /*********NSMutableArray **********/
    //新建array
    NSMutableArray *testArray = [NSMutableArray arrayWithObjects:@"111111",@"22222",@"3333",@"4444",nil];
    
    //取具体的某一个
    [testArray objectAtIndex:0]
     //计数器
    UIScrollView * testview1 = [[UIScrollView alloc]init];
    //alloc 后。计数器就为1
    NSLog(@"retainCount1:%d",[testview1 retainCount]);
        
    //计数器会加1
    [testview1 retain];
     NSLog(@"retainCount2:%d",[testview1 retainCount]);
        
    //release 后。计数器减1 。当计数器为0时。系统才释放
    [testview1 release];
    NSLog(@"retainCount3:%d",[testview1 retainCount]);
    //当动画停止的时候,调用hideAnimationStopped事件
     [UIView setAnimationDidStopSelector:@selector(hideAnimationStopped)];
     
    //opacity 实现视图的淡入淡出效果
    CABasicAnimation *testAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
        //后面的值为0~1 表示当前视图的透明度。
    testAnimation.fromValue = [NSNumber numberWithFloat:1];
        //当值为正数时 表示淡入。。当为负数时表示淡出。相当于退出慢慢谈出
    testAnimation.toValue =[NSNumber numberWithFloat:-0.5];
    testAnimation.duration = 3.0;
    //CABasicAnimation   当动画停止时。触发事件
    
    -(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
    {
        [self tooverview];
    }

    qingjoin

  • 相关阅读:
    ubuntu下无法在目录下创建文件夹,权限不足解决办法
    mongo中的模糊查询
    mysql中的模糊查询
    mysql安装与配置详情
    Django model中的class Meta详解
    kafka集群搭建
    myeclipse/eclipse添加Spket插件实现ExtJs4.2/ExtJs3智能提示
    博客园自定义标题、阅读目录、导航栏、活动的推荐&反对按钮
    IntelliJ IDEA 14 创建maven项目二
    EXT4.2--Ext Designer 使用
  • 原文地址:https://www.cnblogs.com/qingjoin/p/2597827.html
Copyright © 2020-2023  润新知