Latest 0.0.2
Homepage https://github.com/tonyzonghui/ISPageScrollView
License MIT Copyright (C) 2013 Zhang Zonghui

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Platforms ios , requires ARC
Authors

Note: This is a sub-project of UIKitHelper git project. You may want to use UIKitHelper in your project for more UIKit utilities.


Description

ISPageScrollView is a UIScrollView subclass optimised for huge number of pages display. It uses lazy-loading mechanism to maintain only the previous few pages and the next few pages in order to minimize the memory usage.

Properties:

id dataSource: Like UITableViewDataSource, it asks its dataSource object for views displayed in each page.

id pageDelegate: Tells receiver when a page will be removed from cache, has been removed from cache or when the displayed page changed.

NSInteger numberOfReusablePages: number of pages maintanined in memory. This number should be an odd number (e.g: 5 = current displayed page + 2 pages in front + 2 pages after)

NSMutableDictionary readonly scrollViewAvailablePages: this is the dictionary that stores the views of the pages in memory. The keys for the dictionary are NSNumbers for page index. The values for each key is an UIView object.

DataSource required methods

*-viewForScrollView:(ISPageScrollView )scrollView page:(NSInteger)pageIndex**: Needs to return the view to use on specified page.

*-numberOfPagesForPageScrollView:(ISPageScrollView )scrollView**: Needs to return the number of pages in the scroll view.

Usage

It can be created in xcode like UIScollView or can be created programatically.

ISPageScrollView *pageScrollView = [[ISPageScrollView alloc] initWithFrame:CGRectMake(0, 0, 200, 100)];
pageScrollView.dataSource = self;
pageScrollView.numberOfReusableViews = 5;

[pageScrollView displayPage:0];

Also implement both methods of the datasource.

License

UIKitHelper is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "ISPageScrollView",
    "version": "0.0.2",
    "summary": "ISPageScrollView is a UIScrollView subclass optimised for huge number of pages display.",
    "description": "ISPageScrollView is a UIScrollView subclass optimised for huge number of pages display. It uses lazy-loading mechanism to maintain only the previous few pages and the next few pages in order to minimize the memory usage.",
    "homepage": "https://github.com/tonyzonghui/ISPageScrollView",
    "license": {
        "type": "MIT",
        "text": "               Copyright (C) 2013 Zhang Zonghuinn               Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:nn               The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.nn               THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.n               n"
    },
    "authors": {
        "Zhang Zonghui": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tonyzonghui/ISPageScrollView.git",
        "tag": "0.0.2"
    },
    "platforms": {
        "ios": null
    },
    "source_files": "*.{h,m,mm}",
    "requires_arc": true
}

Pin It on Pinterest

Share This