菜單它只顯示選擇按鈕,但我想,當我選擇你好2開Hello2視圖控制器。
我的代碼:
enter code here
- (IBAction)selectClicked:(id)sender {
NSArray * arr = [[NSArray alloc] init];
arr = [NSArray arrayWithObjects:@"Hello 0", @"Hello 1", @"Hello 2", @"Hello 3", @"Hello 4", @"Hello 5", @"Hello 6", @"Hello 7", @"Hello 8", @"Hello 9",nil];
NSArray * arrImage = [[NSArray alloc] init];
arrImage = [NSArray arrayWithObjects:[UIImage imageNamed:@"apple.png"], [UIImage imageNamed:@"apple2.png"], [UIImage imageNamed:@"apple.png"], [UIImage imageNamed:@"apple2.png"], [UIImage imageNamed:@"apple.png"], [UIImage imageNamed:@"apple2.png"], [UIImage imageNamed:@"apple.png"], [UIImage imageNamed:@"apple2.png"], [UIImage imageNamed:@"apple.png"], [UIImage imageNamed:@"apple2.png"], nil];
if(dropDown == nil) {
CGFloat f = 200;
dropDown = [[NIDropDown alloc]showDropDown:sender :&f :arr :arrImage :@"down"];
dropDown.delegate = self;
}
else {
[dropDown hideDropDown:sender];
[self rel];
}
}
-(void)rel{
// [dropDown release];
dropDown = nil;
}
設置一些標記按鈕和按按鈕選擇,檢查相應地使用標記和打開視圖控制器來單擊哪個按鈕。 – Girish
什麼是NIDropDown類?是否存在表視圖的didSelectRowAtIndexPath方法? –
@SharanyaKM在NIDropDown.m中有這種方法http://pastie.org/7978703 – Mhmt