PunchScrollView 1.1.2

PunchScrollView 1.1.2

测试已测试
语言语言 MUMPSMUMPS
许可证 MIT
发布最新发布2020年3月

Christian Menschel维护。



PunchScrollView

Build Status Cocoapods Version CocoaPods Platform

PunchScrollView是一个简化版的UIScrollView子类,适用于iOS,其功能类似于UICollectionView或UITableView框架。

简易快速实现:代理、数据源方法和获取器与UITableView类似。利用类似于UITableView或UICollectionView中已知的NSIndexPath模式的好处。这允许与Core Data轻松组合设置。

  • 有用的方法,例如跳转或滚动到指定页面
  • 避免样板代码
  • 通过自动获取节省大量内存
  • 附带的示例项目可用于演示用法
  • 无限滚动

在ViewController中的示例设置

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;
}

问题

  • 目前在iOS 8中切换为横屏模式时,当无限滚动(在极少数情况下)存在问题。可见页面的布局不正确。