【发布时间】:2012-03-26 06:07:57
【问题描述】:
我创建了一个下拉类,用于在单击按钮上弹出一个窗口,它工作正常,但有一个问题是我如何处理它返回索引的事件(在为它自己的按钮选择的 tableview 的弹出窗口上) 我在那里搞错了什么?有人指导我该怎么做吗??
这里的代码..
-(IBAction)popupOnClikingButton:(id)sender{
if (sender == button1) {
arrayData = [[NSMutableArray alloc] initWithArray:[NSMutableArray arrayWithObjects:@"Test1",@"Test2",nil]];
dropDownView = [[DropDownView alloc] initWithArrayData:arrayData cellHeight:30 heightTableView:150 paddingTop:-3 paddingLeft:-1 paddingRight:-1 refView:button1 animation:BLENDIN openAnimationDuration:2 closeAnimationDuration:2];
dropDownView.delegate = self;
[dropDownView openAnimation];
[self.view addSubview:dropDownView.view];
return;
}
if (sender == button2) {
[arrayData release];
arrayData = [[NSMutableArray alloc] initWithArray:[NSMutableArray arrayWithObjects:@"Demo1",@"Demo2",nil]];
dropDownView = [[DropDownView alloc] initWithArrayData:arrayData cellHeight:30 heightTableView:150 paddingTop:-3 paddingLeft:-1 paddingRight:-1 refView:button1 animation:BLENDIN openAnimationDuration:2 closeAnimationDuration:2];
dropDownView.delegate = self;
[dropDownView openAnimation];
[self.view addSubview:dropDownView.view];
return;
}
}
return index DropDownDelegate 方法是.. 我如何处理这个事件,即 returnIndex 的哪个按钮??
-(void)dropDownCellSelected:(NSInteger)returnIndex{
//set for title that which button is selected here for Ex.
[button1 setTitle:[arrayData objectAtIndex:returnIndex] forState:UIControlStateNormal];
}
【问题讨论】:
-
这里的人无法理解您的问题,这就是您投反对票的原因...提高您的问题质量。
-
你的英文听不懂。
-
不抱歉,只是重写问题。
标签: iphone objective-c ios ios4 uibutton