OGeek|极客世界-中国程序员成长平台

标题: iphone - 下拉列表实现 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 22:48
标题: iphone - 下拉列表实现

enter image description here

如何在按钮点击时实现下拉列表,如图中所示?



Best Answer-推荐答案


这使它看起来真的像一个下拉列表。这是我用来创建一个的代码。为此首先导入框架,制作动态 View 并添加背景图像。然后在动态 View 中添加表格。

-(IBAction)DropDownTableid)sender
    {
        UIView *BackGrView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 200)];

        BackGrView.hidden = NO;
        if(TableView.frame.origin.y ==203)
        {
            [UIView beginAnimations:nil context:NULL]; 
            [UIView setAnimationDuration:0.5f];
            [TableView setFrame:CGRectMake(224, 204, 27, 160)];
            [UIView commitAnimations];
            [self.view TableView];
        }

        else if (TableView.frame.origin.y == 204)
        {
            [TableView setFrame:CGRectMake(224, 203, 27, 0)];
            BackGrView.hidden = YES;
        }

        [self.view addSubview:TableActivityLevel];
    }

关于iphone - 下拉列表实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12541736/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4