LTScrollViewiOS ScrollView 嵌套解决方案

联合创作 · 2023-09-26 06:11

ScrollView 嵌套 ScrolloView(UITableView 、UICollectionView)解决方案, 支持OC / Swift。


CI Status Version License Platform



Demo文件路径以及说明



  • LTScrollView / Example : 为 Swift 使用示例.

  • LTScrollView / OCExample : 为 OC 使用示例.

  • 支持的子 View 为 UIScrollView、UICollectionView、UITableView.


CocoaPods安装


安装CocoaPods 使用以下命令:




$ gem install cocoapods


Podfile


在你的 Podfile中添加LTScrollView




source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'TargetName' do
#注意此处需要添加use_frameworks!
use_frameworks!

pod 'LTScrollView', '~> 0.2.0'
end


然后,使用以下命令安装




$ pod install


提示错误 [!] Unable to find a specification for LTScrollView 解决办法:




$ pod repo remove master
$ pod setup


Swift使用说明


Swift.LTSimple使用说明



  1. 创建LTSimpleManager实例对象




@objc public init(frame: CGRect, viewControllers: [UIViewController], titles: [String], currentViewController:UIViewController, layout: LTLayout)



  1. 设置headerView




@objc public func configHeaderView(_ handle: (() -> UIView?)?)



  1. 子控制器中glt_scrollView进行赋值




self.glt_scrollView = self.tableView(self.scrollView / self.collectionView)



  1. 更多使用说明请参考Demo(LTScrollView / Example)


Swift.LTAdvanced使用说明



  1. 创建LTAdvancedManager实例对象、并设置headerView




@objc public init(frame: CGRect, viewControllers: [UIViewController], titles: [String], currentViewController:UIViewController, layout: LTLayout, headerViewHandle handle: () -> UIView)



  1. 子控制器中glt_scrollView进行赋值




self.glt_scrollView = self.tableView(self.scrollView / self.collectionView)



  1. 更多使用说明请参考Demo(LTScrollView / Example)


OC使用说明


OC.LTSimple使用说明



  1. 创建LTSimpleManager实例对象




[[LTSimpleManager alloc] initWithFrame:frame viewControllers:self.viewControllers titles:self.titles currentViewController:self layout:self.layout]



  1. 设置headerView




[self.managerView configHeaderView:^UIView * _Nullable{ }]



  1. 子控制器中glt_scrollView进行赋值




self.glt_scrollView = self.tableView(self.scrollView / self.collectionView)



  1. 更多使用说明请参考Demo(LTScrollView / OCExample)


OC.LTAdvanced使用说明



  1. 创建LTAdvancedManager实例对象、并设置headerView




[[LTAdvancedManager alloc] initWithFrame:frame viewControllers:self.viewControllers titles:self.titles currentViewController:self layout:self.layout headerViewHandle:^UIView * _Nonnull{}]



  1. 子控制器中glt_scrollView进行赋值




self.glt_scrollView = self.tableView(self.scrollView / self.collectionView)



  1. 更多使用说明请参考Demo(LTScrollView / OCExample)


LTLayout属性说明


详情查看LTLayout.swift

浏览 30
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报