I have a UICollectionView
inside a UIViewController
. Now, I need to add a UIPageViewController
inside the custom UICollectionViewCell
that i created. How can i do this ?
Here's my approach.
UIVIewController.h
class
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
PViewCollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
[cell.pageViewController addTarget:self action:@selector(changed:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
PViewCollectionViewCell.h
Class
#import <UIKit/UIKit.h>
@interface PViewCollectionViewCell : UICollectionViewCell <UIPageViewControllerDataSource>
@property (strong, nonatomic) IBOutlet UIImageView *pageBannerImageView;
@property (strong, nonatomic) IBOutlet UIPageControl *pageViewController;
- (IBAction)pageVIewChanged:(id)sender;
@end