ios - UITableViewCell 与下拉 UITableView
问题描述
我正在使用具有“n”行数的 UITableView。在每个单元格中,我都有一个菜单按钮。当我单击菜单按钮时,我需要在每个单元格中显示一个包含 3 行的下拉 UITableView。如何设置下拉 UITableView 的框架。我正在使用目标c。
当我单击菜单按钮时,我需要在每个单元格的菜单按钮下方显示报告 UITableView
解决方案
这有点复杂,但并不难。幸运的是,我们有一个名为DropDown的库。这使得这项任务非常容易。
添加pod 'DropDown'
到您的 Podfile。
let dropDown = DropDown()
// The view to which the drop down will appear on
dropDown.anchorView = view // UIView or UIBarButtonItem in your case that menu button
// The list of items to display. Can be changed dynamically
dropDown.dataSource = ["Report"]
dropDown.selectionAction = { [unowned self] (index: Int, item: String) in
print("Selected item: \(item) at index: \(index)")
}
dropDown.show()
在 Objective-C 中
DropDown *dropDown = [[DropDown alloc] init];
dropDown.selectionAction = ^(NSInteger, NSString * _Nonnull) {
//code
};
Swift 中的库,但您可以使用桥接头在 Objective C 中使用它。希望这会对您有所帮助
推荐阅读
- r - metafor 中 rma 对象的样本外预测
- sql - 未明确说明时选择不包括空值
- html - 如何将图像带入 SVG?
- java - 如何在daikon中运行程序的junit测试?
- java - 如何使用 Java 应用程序连接到 DynamoDB 表并将项目插入其中
- apache-flink - 本地模式下的 Apache Flink 任务管理器数量
- css - 我们如何在 react-native 中设计箭头卡
- postgresql - 如何访问外部表上的大型对象存储
- ios - 通过 CGContext 绘制 UIButton 图像
- python - 导入 Mod “from holoext.bokeh import Mod”时出现散景错误