首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >带下拉UITableView的UITableViewCell

带下拉UITableView的UITableViewCell
EN

Stack Overflow用户
提问于 2018-05-25 12:09:42
回答 1查看 1.3K关注 0票数 -1

我使用的是行数为'n‘的UITableView。在每个单元格中,我都有一个菜单按钮。当我点击菜单按钮时,我需要在每个单元格中显示一个包含3行的下拉UITableView。如何为dropdown UITableView设置框架。我使用的是objective c。

当我单击菜单按钮时,我需要在每个单元格的菜单按钮下面显示report UITableView

EN

回答 1

Stack Overflow用户

发布于 2018-05-25 13:28:32

这有点复杂,但并不难。幸运的是,我们有一个名为DropDown的库。这使得这项任务变得非常容易。

pod 'DropDown'添加到您的Podfile。

代码语言:javascript
复制
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中

代码语言:javascript
复制
DropDown *dropDown = [[DropDown alloc] init];
dropDown.selectionAction = ^(NSInteger, NSString * _Nonnull) {
    //code
};

库,但您可以在Objective C中使用桥接头。希望这将对您有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50521416

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档