- Block-driven page setup.
- Auto Layout friendly.
- Page reusability à la UITableView reusable cells.
pod 'DRPageScrollView'
Drag and copy all files in the DRPageScrollView folder into your project.
Enabling page reusability is ridiculously simple:
pageScrollView.pageReuseEnabled = YES;
Note: pageReuseEnabled
is meant to be set to the desired value before adding any pages to the page scroll view.
Using Auto Layout on the subviews is not compulsory, but it's highly recommended. For the sake of simplicity, the example below doesn't contain Auto Layout code.
[pageScrollView addPageWithHandler:^(UIView *pageView) {
UIView *squareView = [UIView new];
squareView.backgroundColor = [UIColor redColor];
squareView.frame = CGRectMake(50, 50, 100, 100);
[pageView addSubview:squareView];
}];
DRPageScrollView is available under the MIT license.