- (UIButton *)viewAllBtns:(int)tag {
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setTitle:@"View All" forState:UIControlStateNormal];
[btn setTitleColor:viewAllBtnColour forState:UIControlStateNormal];
btn.tag = tag;
[btn addTarget:self action:@selector(viewAllMethod:)forControlEvents:UIControlEventTouchUpInside];
[containerView addSubview:btn];
return btn;
}
- (void)viewAllMethod:(id)sender {
UIButton *button=(UIButton *)sender;
switch([button tag]){
case 1: [dashboardVc.carbonSwipeNavigation setCurrentTabIndex:1]; break;
case 2: [dashboardVc.carbonSwipeNavigation setCurrentTabIndex:2]; break;
case 3: [dashboardVc.carbonSwipeNavigation setCurrentTabIndex:3]; break;
default: break;
}
}
Bitte versuchen Sie diese Methode ..
Können Sie uns ein Beispiel, das nicht funktioniert? Es wird besser sein, Ihnen beim Debuggen zu helfen. – e666