-1

I am using UITableView with 'n' number of rows. In each cell i am having one menu button. when i click on menu button I need to show one dropdown UITableView with 3 rows in every cell. How I can set the frame for dropdown UITableView. I am using objective c.

enter image description here

when I click on menu button I need to show report UITableView below the menu button on every cell

Gaurav Patel
  • 532
  • 1
  • 5
  • 19
09121989
  • 95
  • 1
  • 1
  • 7
  • 2
    Possible duplicate of [How to show the TableView (like dropdown) on Button Click in iPhone?](https://stackoverflow.com/questions/19628214/how-to-show-the-tableview-like-dropdown-on-button-click-in-iphone) – Manmohan_singh May 25 '18 at 04:14
  • google it , name : expand & collapse tableview, accordion table view, etc – Anbu.Karthik May 25 '18 at 04:17
  • please share more specific information if you have googled and not found anything relevant – Surbhi Garg May 25 '18 at 05:13

1 Answers1

0

It's little complex one but not hard. luckly we have one library called DropDown. This make this task very easy.

Add pod 'DropDown' to your 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()

In Objective-C

DropDown *dropDown = [[DropDown alloc] init];
dropDown.selectionAction = ^(NSInteger, NSString * _Nonnull) {
    //code
};

Library in Swift but you can use bridging header to use that in Objective C. Hope this will help you

Ganesh Manickam
  • 2,113
  • 3
  • 20
  • 28