我想在我的iOS应用程序中实现以下下拉功能。怎么办?

时间:2022-09-12 07:30:17

This is screen shot, in the last drop down menu is there, I clicked it and it's showing some menus that one

这是屏幕截图,在最后一个下拉菜单中,我点击了它,它显示了一些菜单

我想在我的iOS应用程序中实现以下下拉功能。怎么办?

but instead of that, here I want to add sorting menus like,

但不是这样,在这里我想添加排序菜单,如,

1. sort by date
2. sort by name
3. sort by ...etc

2 个解决方案

#1


0  

For short array by a key.. Like Name....Put the key on which you want to short your array

对于按键的短数组..类似名称....放置要在其上缩放数组的键

This will Short your array Ascending

这将使您的阵列升序缩短

 NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"Your Key"  ascending:YES  selector:@selector(localizedStandardCompare:)];
 NSArray *shortedArray=[Your array sortedArrayUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]];

This will Short your array Decending

这会缩短您的阵列降序

 NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"Your Key"  ascending:NO  selector:@selector(localizedStandardCompare:)];
 NSArray *shortedArray=[Your array sortedArrayUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]];

#2


1  

i used DropDown for my project, we can easily customize these DropDownCell(customCell) & Appearance too.

我将DropDown用于我的项目,我们也可以轻松自定义这些DropDownCell(customCell)和Appearance。

You can able to integrate with your project through PODS

您可以通过PODS与您的项目集成

pod 'DropDown'

#1


0  

For short array by a key.. Like Name....Put the key on which you want to short your array

对于按键的短数组..类似名称....放置要在其上缩放数组的键

This will Short your array Ascending

这将使您的阵列升序缩短

 NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"Your Key"  ascending:YES  selector:@selector(localizedStandardCompare:)];
 NSArray *shortedArray=[Your array sortedArrayUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]];

This will Short your array Decending

这会缩短您的阵列降序

 NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"Your Key"  ascending:NO  selector:@selector(localizedStandardCompare:)];
 NSArray *shortedArray=[Your array sortedArrayUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]];

#2


1  

i used DropDown for my project, we can easily customize these DropDownCell(customCell) & Appearance too.

我将DropDown用于我的项目,我们也可以轻松自定义这些DropDownCell(customCell)和Appearance。

You can able to integrate with your project through PODS

您可以通过PODS与您的项目集成

pod 'DropDown'