zoukankan      html  css  js  c++  java
  • UIBotton UIlabel Ios 下拉框

    //下拉列表动画加载
    -(void)dropDownListAnimation
    {
        SchoolInHandAppDelegate *app = [[UIApplication sharedApplication]delegate];
        //每行的高度
        everyListHight = 30;
        listHight = userCountInFile*everyListHight;
        presstimes ++;
        if(_dropDownbackView ==nil)
        {
            _dropDownbackView = [[UIScrollView alloc]init];
            [_dropDownbackView autorelease];
        }
        _dropDownbackView.frame = CGRectMake(49, 180, 223, listHight);
        [self.view addSubview:_dropDownbackView];
        
        if(_dropDownListView==nil)
        {
            _dropDownListView = [[UIScrollView alloc]init];
            [_dropDownListView autorelease];
        }
        _dropDownListView.frame = CGRectMake(0, 0, 223, listHight);
        //_dropDownbackView.backgroundColor = [UIColor redColor];
        int i;
        int n = 0;
        //UIColor *color = [UIColor colorWithPatternImage:[UIImage imageNamed:@"listbg.png"]];
        for(i = 0; i<userCountInFile; i++)
        {
            UILabel *userTitleLabel = [[UILabel alloc]init];
            NSString *userNameStr = [[NSString alloc]init];
            userNameStr = [[app.moudle.userNameInFileList objectAtIndex:i]objectForKey:LOGIN_NAME];
            UIButton *usernamebutton = [UIButton buttonWithType:UIButtonTypeCustom];
            //[usernamebutton setTitle:userNameStr  forState:UIButtonTypeCustom];
            usernamebutton.frame = CGRectMake(0, 0+n, 223, everyListHight);
            [usernamebutton setImage:[UIImage imageNamed:@"listbg.png"]forState:UIControlStateNormal ];
            //usernamebutton.backgroundColor = color;
            
            userTitleLabel.frame = CGRectMake(8, 0, 215, everyListHight);
            userTitleLabel.text = userNameStr;
            userTitleLabel.textColor = [UIColor whiteColor];
            userTitleLabel.font = [UIFont systemFontOfSize:14];
            userTitleLabel.backgroundColor = [UIColor clearColor];
            
            //删除按键
            UIButton *delbutton = [UIButton buttonWithType:UIButtonTypeCustom];
            delbutton.frame = CGRectMake(183, 0, 40, everyListHight);
            [delbutton setImage:[UIImage imageNamed:@"del.png"]forState:UIControlStateNormal ];
            [delbutton setImage:[UIImage imageNamed:@"deled.png"]forState:UIControlStateSelected ];
            [delbutton addTarget:self action:@selector(deleteBtnPress:) forControlEvents:UIControlEventTouchUpInside];
           
            
            [usernamebutton addSubview:delbutton];
            [usernamebutton addSubview:userTitleLabel];
            [usernamebutton addTarget:self action:@selector(chooessUserName:) forControlEvents:UIControlEventTouchUpInside];
            [_dropDownListView addSubview:usernamebutton];
            n = n + everyListHight;
            usernamebutton.tag = i;
            delbutton.tag = i;
            //[userNameStr release];
        }
        //动画
        _dropDowAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
        if(presstimes%2 != 0)
        {
            _dropDowAnimation.fromValue = [NSNumber numberWithFloat:-listHight];
        }
        else 
        {
            _dropDownListView.frame = CGRectMake(0, -300, 223, listHight);
            
            _dropDowAnimation.fromValue = [NSNumber numberWithFloat:listHight];
        }
        _dropDowAnimation.toValue = [NSNumber numberWithFloat:0];
        //_dropDownListView.backgroundColor = [UIColor redColor];
        //x,y轴缩小到0.1,Z 轴不变
        //持续时间
        _dropDowAnimation.duration = 0.35;
        //重复次数
        _dropDowAnimation.repeatCount = 1;
        _dropDowAnimation.delegate = self;
        //设置_dropDownListView 的容量。
        [_dropDownListView setContentSize:CGSizeMake(185, listHight+20)];
        [_dropDownListView.layer addAnimation:_dropDowAnimation forKey:nil];
        [_dropDownbackView addSubview:_dropDownListView];
        
        //当第二次点的时候删除view。否则用户名就不能输入。
        if(presstimes%2 == 0)
        {
            [_dropDownbackView removeFromSuperview];
            _dropDownListView = nil;
            _dropDownbackView = nil;
        }
    }
  • 相关阅读:
    数论学习笔记之欧拉函数
    [CQOI2014]危桥
    lspci -nnk
    linux 详解useradd 命令基本用法
    。 (有些情况下通过 lsof(8) 或 fuser(1) 可以 找到有关使用该设备的进程的有用信息)
    CentOS 7 设置默认进入字符界面
    下面附上top和sar的使用方法,方便参考! "top"工具
    Centos7/RHEL7 开启kdump
    Linux内存带宽的一些测试笔记
    调试测试
  • 原文地址:https://www.cnblogs.com/qingjoin/p/2674543.html
Copyright © 2011-2022 走看看