https://github.com/tapwork/punchscrollview
PunchScrollView is a iOS ScrollView framework which works like the UITableView
https://github.com/tapwork/punchscrollview
Last synced: 8 months ago
JSON representation
PunchScrollView is a iOS ScrollView framework which works like the UITableView
- Host: GitHub
- URL: https://github.com/tapwork/punchscrollview
- Owner: tapwork
- License: mit
- Created: 2010-11-12T16:44:16.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2022-07-22T00:54:57.000Z (almost 4 years ago)
- Last Synced: 2025-07-20T20:21:43.731Z (11 months ago)
- Language: Objective-C
- Homepage:
- Size: 744 KB
- Stars: 131
- Watchers: 4
- Forks: 23
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PunchScrollView
[](https://travis-ci.org/tapwork/PunchScrollView)
[](https://github.com/tapwork/PunchScrollView/blob/master/PunchScrollView.podspec)
[](https://github.com/tapwork/PunchScrollView/blob/master/LICENSE)
[]()
PunchScrollView is a little UIScrollView subclass for iOS which works like UICollectionView or UITableView Frameworks.
Easy and fast implementation: delegate, dataSource methods and getter are similar to the UITableView.
Use the benefits of the NSIndexPath pattern like you already know it from UITableView or UICollectionView.
This allows an easy setup in combination with Core Data.
- Helpful methods, i.e. jump or scroll to a desired page
- Avoid boilerplate code
- Save lots of memory with automatic dequeuing
- Comes with an Example project to demonstrate the usage
- Infinite scrolling
Example setup in the ViewController
``` objective-c
self.scrollView = [[PunchScrollView alloc] init];
self.scrollView.delegate = self;
self.scrollView.dataSource = self;
self.scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:self.scrollView];
#pragma mark - PunchScrollViewDataSource
- (NSInteger)numberOfSectionsInPunchScrollView:(PunchScrollView *)scrollView
{
return 3;
}
- (NSInteger)punchscrollView:(PunchScrollView *)scrollView numberOfPagesInSection:(NSInteger)section
{
return 3;
}
- (UIView*)punchScrollView:(PunchScrollView*)scrollView viewForPageAtIndexPath:(NSIndexPath *)indexPath
{
ExamplePageView *page = (ExamplePageView*)[scrollView dequeueRecycledPage];
if (page == nil)
{
//
// You could also use PunchScrollview as gallery scrollview - just change the size of the desired view
//
page = [[ExamplePageView alloc] initWithFrame:self.view.bounds];
page.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
}
page.titleLabel.text = [NSString stringWithFormat:@"Page %@ in section %@", @(indexPath.row), @(indexPath.section)];
return page;
}
```
#### Issues
* Right now there is an issue when turning to landscape since iOS 8 with infinite scrolling (only in rare cases). Layouting is not right for the visible page.