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

时间:2017-07-18 05:10:39

标签: ios objective-c iphone cocoa-touch drop-down-menu

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

enter image description here

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

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

2 个答案:

答案 0 :(得分:1)

我使用DropDown作为我的项目,我们可以轻松自定义这些DropDownCell(customCell)&外表也是。

您可以通过PODS

与项目集成
  

pod' DropDown'

答案 1 :(得分:0)

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

这将使你的数组​​升序

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

这将使您的阵列缩短

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