У меня есть UICollectionView с нижним колонтитулом. Класс нижнего колонтитула создается мной. Представление нижнего колонтитула - это кнопка, которую я хочу применить. Я попытался добавить одно действие, но ничего не произошло, когда я нажал кнопку. Пожалуйста, помогите мне.UICollectionView - Добавить действие в нижний колонтитул
Мой код:
FViewController.m
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
UICollectionReusableView *reusableview = nil;
if (kind == UICollectionElementKindSectionFooter) {
FooterCollectionReusableView *footerview = [[FooterCollectionReusableView alloc] init];
footerview = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"FooterView" forIndexPath:indexPath];
[footerview.todoButton addTarget:self action:@selector(todosPush:) forControlEvents:UIControlEventTouchUpInside];
reusableview = footerview;
}
return reusableview;
}
-(IBAction)todosPush:(id)sender{
NSLog(@"todosPush");
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
TipoEjercicioViewController *tipo = [storyBoard instantiateViewControllerWithIdentifier:@"TipoEjercicioView"];
tipo.ejercicio = 22;
[self.navigationController pushViewController:tipo animated:YES];
}
FooterCollectionReusableView.h
@interface FooterCollectionReusableView : UICollectionReusableView
@property (nonatomic, retain) IBOutlet UIButton * todoButton;
@end
попробовать после удаления 'UITapGestureRecognizer' –
Я пытался, но ничего не происходит .... – amurcia
вы использовали точка останова? ваш todosPush вызывается или нет –