uiviewcontroller中的多个DropDownList

ios开发人员

我有5个下拉列表。我想按以下方式打开和关闭该drodownlist(UIView):
1.如果单击第一个按钮,它将打开下拉列表,第二次单击它将关闭。
2.如果在第一个按钮上单击打开了一个下拉列表,而我在第二个按钮上单击,则第一个下拉列表将关闭,第二个下拉列表将打开。
我能够以(1)的方式打开和关闭下拉列表。但在第二种情况下我无法。
这是我的代码。

 if ([self.DropDownView  isDescendantOfView:self.view])
{


       [self dropDownCloseAnimation:sender withTF:nil];
        [self.DropDownView removeFromSuperview];
//        [self performSelector:@selector(showMenu:)  withObject:sender afterDelay:0.1];
    }
    else
    {
        [self.SinupView addSubview:self.DropDownView];
        [self dropDownAnimation:sender withTF:nil];
    }


这是动画下拉列表的功能

    -(void)dropDownCloseAnimation : (UIButton *)sender withTF : (UITextField *)textField
{
    if (sender.tag == 203 || textField.tag == 106)
    {
        [UIView animateWithDuration:0.9 animations:^{
            self.DropDownView.frame = CGRectMake(self.TFVehicalType.frame.origin.x, self.TFVehicalType.frame.origin.y + self.TFVehicalType.frame.size.height + 2, self.TFVehicalType.frame.size.width, 0);
        } completion:nil];
    }
    else if (sender.tag == 204 || textField.tag == 107)
    {
        [UIView animateWithDuration:0.5 animations:^{
            self.DropDownView.frame = CGRectMake(self.TFVehicalColor.frame.origin.x, self.TFVehicalColor.frame.origin.y + self.TFVehicalColor.frame.size.height + 2, self.TFVehicalColor.frame.size.width, 0);
        } completion:nil];
    }
    else if (sender.tag == 205 || textField.tag == 112)
    {
        [UIView animateWithDuration:0.5 animations:^{
            self.DropDownView.frame = CGRectMake(self.TFCity.frame.origin.x, self.TFCity.frame.origin.y + self.TFCity.frame.size.height + 2, self.TFCity.frame.size.width, 0);
        } completion:nil];
    }
    else if (sender.tag == 206 || textField.tag == 113)
    {
        [UIView animateWithDuration:0.5 animations:^{
            self.DropDownView.frame = CGRectMake(self.TFLocation.frame.origin.x, self.TFLocation.frame.origin.y + self.TFLocation.frame.size.height + 2, self.TFLocation.frame.size.width, 0);
        } completion:nil];
    }
    else if (sender.tag == 207 || textField.tag == 114)
    {
        [UIView animateWithDuration:0.5 animations:^{
            self.DropDownView.frame = CGRectMake(self.TFStatus.frame.origin.x, self.TFStatus.frame.origin.y + self.TFStatus.frame.size.height + 2, self.TFStatus.frame.size.width, 0);
        } completion:nil];
    }
}
穆罕默德·巴希尔·西达尼(Mohammad Bashir Sidani)

1-制作一个数组

2-在屏幕上显示每个下拉列表后,将其添加到数组中

3-在按下打开/关闭任何下拉菜单的操作中,在我们刚刚做过的数组上循环

4-并关闭每次迭代的每个下拉列表

5-打开发件人之一。

祝您编码愉快!

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Swift 中主 UIViewController 中的多个 UIViewController

在DropDownList错误中不能选择多个项目

jQuery与相同类名中的多个DropDownList混淆

DropDownList 中带有受保护工作表的多个项目

DropDownList在MVC3中获得多个值

在单个UIViewController中具有多个UIView的障碍

如何在Swift的UIViewController中添加多个集合视图?

如何从嵌入在不同UINavigationControllers中的多个UIViewController中选择一个UIViewController

如何将HTML dropdownlist的多个值存储到数组中,并使用PHP以逗号分隔它们?

如何在 ASP.Net MVC 中显示多个 DropDownList 并获取值

如何在MVC 5中使用DropdownListFor在多个DropDownList中选择值

UIViewController上有多个shadowOffset

如何区分iOS UIKit数据源和同一UIViewController中的多个对象的委托方法?

GridView中的DropDownList

页脚模板中的DropDownList

GridView中的DropDownList

在 .net 中填充 DropDownList

子 UIViewController 中的 resignFirstResponder

UIViewController中的UISearchBar崩溃

UIViewController中的UISearchController

忽略UIViewController中的UIPanGesture

UIViewController中的插座

在UIViewController中关闭键盘

UIPageViewController 中的相同 UIViewController

UIView 中的 iOS UIViewController

从CloudFormation模板的DropDownList中选择多个值

保存DropDownList用于多个选定值

使用多个DropDownList标识要显示的图像

如何在DataTextField中将多个db列显示为一个项目,而不是在dropdownlist中并排显示