1
我需要在我的應用程序中顯示下拉框。混淆如何打開UIPicker視圖中的兩個按鈕單擊事件的兩個數組值
大多數人建議我UIPickerView爲下拉框。
但我的要求是我需要在我的應用程序中放置兩個下拉框。
我對UIPicker視圖代碼是
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView {
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
return [arrayColors count];
}
- (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
return [arrayColors objectAtIndex:row];
}
- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
NSLog(@"Selected Color: %@. Index of selected color: %i", [arrayColors objectAtIndex:row], row);
}
- (IBAction)dropdown_term_in_years: (id)sender
{
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Ratings"
delegate:self
cancelButtonTitle:@"OK"
destructiveButtonTitle:nil
otherButtonTitles:nil];
UIPickerView *pickerView = [[UIPickerView alloc] init];
//pickerView.datePickerMode = UIDatePickerModeDate;
pickerView.showsSelectionIndicator = YES;
pickerView.dataSource = self;
pickerView.delegate = self;
[menu addSubview:pickerView];
[menu showInView:self.view];
[menu sendSubviewToBack:pickerView];
[menu setBounds:CGRectMake(0,0,320, 300)];
CGRect pickerRect = pickerView.bounds;
//pickerRect.origin.y = -100;
pickerView.bounds = pickerRect;
[pickerView release];
[menu release];
}
這個工程的一次鍵點擊,我需要打開另一個數組值的另一次按鼠標。
我該如何做到這一點。
PLs幫助我。
先謝謝你了。