I have a view and I hv a button on that.I need to have a drop down box on clicking that button. How to implement drop down box?? Drop down box shuold have a table view.When I click rows in table view(after drop down box will open) I want to get text which will be there on the clicked row cell on a view where I had button. How to do that?
Control Center gives you instant access to the things you do the most. You can use Control Center to quickly take a picture, turn on Wi-Fi, control your Apple TV, and more.
Use any element to open the dropdown menu, e.g. a <button>, <a> or <p> element. Use a container element (like <div>) to create the dropdown menu and add the dropdown links inside it. Wrap a <div> element around the button and the <div> to position the dropdown menu correctly with CSS.
Here's a workaround that works for me.
-(IBAction)showDropDownList:(id)sender
{
tableView = [[UITableView alloc] initWithFrame:CGRectMake(7, 135, 200, 0) style:UITableViewStyleGrouped];
tableView.delegate = self;
tableView.dataSource = self;
if (tableState == TableViewStateClosed) { //enum for identifying tableview state
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
CGRect viewRect = self.tableView.frame;
viewRect.size.height += 150;
[self.tableView setFrame:CGRectMake(7, 135, 200, viewRect.size.height)];
[UIView commitAnimations];
[self.view addSubview:tableView];
tableState = TableViewStateOpen;
}
else if (tableState == TableViewStateOpen) {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
[self.inboxTableView setFrame:CGRectMake(7, 135, 200, 0)];
[UIView commitAnimations];
tableState = TableViewStateClosed;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With