as indicated by nicolas, the appropriate code follows. Note. This results in the VC collection never being released (this means that dealloc is never called). We need to find the best solution in the long run or until Apple fixes this iOS 7.x error.
at NibCell.h
@protocol CellToVCDelegate <NSObject> @optional - (void)deleteActivity:(id)sender ; - (void)shareActivity:(id)sender; @end @interface NibCell : UICollectionViewCell{ id <CellToVCDelegate> delegate; } @property (nonatomic, retain) id <CellToVCDelegate> delegate;
at NibCell.m
#pragma mark - Custom Action(s) - (void)deleteActivity:(id)sender { NSLog(@"delete action! %@", sender); [self.delegate deleteActivity:sender]; } - (void)shareActivity:(id)sender { NSLog(@"shareActivity action! %@", sender); [self.delegate shareActivity:sender]; }
in collection VC.h
@interface VC : UIViewController < CellToVCDelegate>
in VC.m:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { NibCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cvCellIdentifier forIndexPath:indexPath]; cell.delegate = self; return cell; }
Gamma point
source share