I have a collectionview[not custom collectionview], and i would like to show an alert ,by clicking the button. But button action doesnt detect the action that is my code:
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [ self.collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
NSArray *sectionArr=[self.ClassesArr objectAtIndex:indexPath.section];
NSDictionary *data = [sectionArr objectAtIndex:indexPath.row];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(54, 25, 15, 15);
[btn addTarget:self action:@selector(subCateBtnAction:) forControlEvents:UIControlEventTouchUpInside];
[cell addSubview:btn];
}
// the button action
-(IBAction)subCateBtnAction:(UIButton *)btn
{
NSArray *sectionArr=[self.ClassesArr objectAtIndex:sectionindex];
NSDictionary *data = [sectionArr objectAtIndex:btn.tag];
NSString *name = [data objectForKey:@"nombreTarifa"];
UIAlertView *Notpermitted=[[UIAlertView alloc] initWithTitle:@""
message:name
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[Notpermitted show];
}
What can be the problem thanks!