如何在按钮事件中显示下拉项目的代码?
问题描述:
大家好,我已经实现了代码显示drapdown项目时,点击自定义按钮 ,但它不工作ios5给显示下拉项目的解决方案,这对我来说太紧急在iphone中。如何在按钮事件中显示下拉项目的代码?
units = [[NSMutableArray alloc] initWithObjects:@"Metric(metres)",@"Imperial(feets)",nil];
dropDownView = [[DropDownView alloc] initWithArrayData:units cellHeight:30 heightTableView:60 paddingTop:-8 paddingLeft:-5 paddingRight:-10 refView:dropdownButton animation:BLENDIN openAnimationDuration:0 closeAnimationDuration:0];
dropDownView.delegate = self;
[dropdownButton setTitle:@"Metric(metres)" forState:UIControlStateNormal];
[self.view addSubview:dropDownView.view];
}
-(void)dropDownCellSelected:(NSInteger)returnIndex{
[dropdownButton setTitle:[units objectAtIndex:returnIndex] forState:UIControlStateNormal];
//[self calculatebuttonaction];
}
#pragma mark -
#pragma mark Class methods
-(IBAction)DropdownButtonClick{
[dropDownView openAnimation];
}
答
什么简单地创建另一个UITableView的(或的UITableViewController),并用它来与PUSH/POP功能,并能无扩大显示下拉列表中的项目?