Latest1.0.6
Homepagehttps://github.com/stefanceriu/SCSafariPageController
LicenseMIT License
Platformsios 8.0
DependenciesSCPageViewController
Authors

SCSafariPageController page view controller component that reproduces the behavior seen in Mobile Safari’s tab switcher and is intended as a demo for SCPageViewController

Features:

  • can zoom out, partially overlap and lean in pages similar to Safari
  • can zoom in and focus on any of the pages and animates the layout change
  • allows swipe to delete on one or multiple pages at the same time
  • dynamically adapts the inter-item spacings and page angles based on the total number of pages, even while swiping to delete
  • increases the page angles when scrolling outside its bounds
  • supports incremental updates

and all the rest of the SCPageViewController niceties.

SCSafariPageController

Implementation details

SCSafariPageController is built on top of SCPageViewController and makes use of custom page layouters to get the desired effects.

It wraps view controllers inside the scroll view based SCSafariPageWrapperViewController to get the slide to delete feature and then applies variable inter-item spacings and sublayer transforms (angle, perspective and scale) to the pages, based on the total number of pages and the content offset.

Usage

  • Create a new instance and register as its data source and, optionally, delegate
    self.safariPageController = [[SCSafariPageController alloc] init];
    [self.safariPageController setDataSource:self];
    [self.safariPageController setDelegate:self];
  • Implement the SCSafariPageControllerDateSource protocol to define the total number of pages and the view controllers to be used for each of them
- (NSUInteger)numberOfPagesInPageController:(SCSafariPageController *)pageController;

- (UIViewController *)pageController:(SCSafariPageController *)pageController viewControllerForPageAtIndex:(NSUInteger)index;
  • Optionally, listen to any of the following delegate events
- (void)pageController:(SCSafariPageController *)pageController didShowViewController:(UIViewController *)controller atIndex:(NSUInteger)index;

- (void)pageController:(SCSafariPageController *)pageController didHideViewController:(UIViewController *)controller atIndex:(NSUInteger)index;

- (void)pageController:(SCSafariPageController *)pageController didNavigateToOffset:(CGPoint)offset;

- (void)pageController:(SCSafariPageController *)pageController didNavigateToPageAtIndex:(NSUInteger)pageIndex;

- (void)pageController:(SCSafariPageController *)pageController willDeletePageAtIndex:(NSUInteger)pageIndex;

- (void)pageController:(SCSafariPageController *)pageController didDeletePageAtIndex:(NSUInteger)pageIndex;
  • Zoom in and out
- (void)zoomOutAnimated:(BOOL)animated completion:(void(^)())completion;

- (void)zoomIntoPageAtIndex:(NSUInteger)index animated:(BOOL)animated completion:(void(^)())completion;
  • SCSafariPageController also supports incremental updates with animations that are customizable through its active layouter
    [self.safariPageController insertPagesAtIndexes:(NSIndexSet *)indexes animated:(BOOL)animated completion:^(void)completion];

    [self.safariPageController deletePagesAtIndexes:(NSIndexSet *)indexes animated:(BOOL)animated completion:^(void)completion]

    [self.safariPageController reloadPagesAtIndexes:(NSIndexSet *)indexes animated:(BOOL)animated completion:^(void)completion]

    [self.safariPageController movePageAtIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex animated:(BOOL)animated completion:^(void)completion]

For more usage examples please have a look at the included demo project (pod try SCSafariPageController)

License

SCSafariPageController is released under the MIT License (MIT) (see the LICENSE file)

Contact

Any suggestions or improvements are more than welcome and I would also love to know if you are using this component in a published application.
Feel free to contact me at [email protected] or @stefanceriu.

Latest podspec

{
    "name": "SCSafariPageController",
    "version": "1.0.6",
    "platforms": {
        "ios": "8.0"
    },
    "summary": "SCSafariPageController page view controller component that reproduces the behavior seen in Mobile Safari's tab switcher",
    "description": "SCSafariPageController page view controller component that reproduces the behavior seen in Mobile Safari's tab switchernFeatures:n- can zoom out, partially overlap and lean in pages similar to Safarin- allows swipe to delete for one or multiple pages at the same timen- increases the page angles when scrolling outside its boundsn- can zoom into any of the pages n- supports incremental updatesnand all the rest of the SCPageViewController niceties.",
    "homepage": "https://github.com/stefanceriu/SCSafariPageController",
    "authors": {
        "Stefan Ceriu": "[email protected]"
    },
    "social_media_url": "https://twitter.com/stefanceriu",
    "source": {
        "git": "https://github.com/stefanceriu/SCSafariPageController.git",
        "tag": "v1.0.6"
    },
    "license": {
        "type": "MIT License",
        "file": "LICENSE"
    },
    "source_files": "SCSafariPageController/**/*.{h,m}",
    "dependencies": {
        "SCPageViewController": []
    }
}

Pin It on Pinterest

Share This