【发布时间】:2015-08-25 09:28:13
【问题描述】:
我在UIViewController 中有一个UICollectionView。现在,我需要在我创建的自定义UICollectionViewCell 中添加一个UIPageViewController。我该怎么做?
这是我的方法。
UIVIewController.h类
-(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 类
#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
【问题讨论】:
-
你想要哪个,UIPageViewController 或 UIPageControl - 它们是非常不同的东西。
-
我在找
UIPageViewController
标签: ios objective-c