### Enable Interactive Pop Gesture Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Document/侧滑手势处理.md Set the delegate for the interactive pop gesture recognizer to enable custom gesture handling. This is typically done in the view controller's setup. ```swift self.navigationController?.interactivePopGestureRecognizer?.delegate = self ``` -------------------------------- ### Gesture Recognizer Delegate for JXPagingView Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Document/侧滑手势处理.md Implement the UIGestureRecognizerDelegate to allow simultaneous recognition of gestures. This is crucial when JXPagingView is present and has horizontal scrolling, preventing conflicts with the navigation controller's pop gesture when the scroll view is not at its starting offset. ```swift // MARK: - UIGestureRecognizerDelegate extension xxVC { func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { if String(describing: otherGestureRecognizer.view.self).contains("JXPagingView"), let scrollView = otherGestureRecognizer.view as? UIScrollView { if scrollView.contentOffset.x <= 0 { return true } } return false } } ``` -------------------------------- ### Initialize JXCategoryTitleView Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Examples/JXPagerViewExample-OC/Pods/JXCategoryView/README.md Initializes a JXCategoryTitleView with a specified frame and assigns a delegate. Add the view to the superview. ```Objective-C self.categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, 0, WindowsSize.width, 50)]; self.categoryView.delegate = self; [self.view addSubview:self.categoryView]; ``` -------------------------------- ### Implement JXCategoryListContentViewDelegate for List View Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Examples/JXPagerViewExample-OC/Pods/JXCategoryView/README.md Implement the `listView` method to return the view of your list. This can be a `UIViewController.view` or a custom `UIView`. ```Objective-C // 返回列表视图 // 如果列表是VC,就返回VC.view // 如果列表是View,就返回View自己 - (UIView *)listView { return self.view; } ``` -------------------------------- ### Implement JXCategoryViewDelegate Methods Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Examples/JXPagerViewExample-OC/Pods/JXCategoryView/README.md Optional delegate methods for handling category view selection and scrolling events. Implement these to respond to user interactions. ```Objective-C //点击选中或者滚动选中都会调用该方法。适用于只关心选中事件,不关心具体是点击还是滚动选中的。 - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index; //点击选中的情况才会调用该方法 - (void)categoryView:(JXCategoryBaseView *)categoryView didClickSelectedItemAtIndex:(NSInteger)index; //滚动选中的情况才会调用该方法 - (void)categoryView:(JXCategoryBaseView *)categoryView didScrollSelectedItemAtIndex:(NSInteger)index; //正在滚动中的回调 - (void)categoryView:(JXCategoryBaseView *)categoryView scrollingFromLeftIndex:(NSInteger)leftIndex toRightIndex:(NSInteger)rightIndex ratio:(CGFloat)ratio; ``` -------------------------------- ### Initialize JXCategoryListContainerView Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Examples/JXPagerViewExample-OC/Pods/JXCategoryView/README.md Initializes JXCategoryListContainerView with a specified type and delegate, then adds it as a subview. Associate it with the categoryView. ```Objective-C self.listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self]; [self.view addSubview:self.listContainerView]; //关联到categoryView self.categoryView.listContainer = self.listContainerView; ``` -------------------------------- ### Initialize JXPagerView in Objective-C Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt Configure JXPagerView using the JXPagerViewDelegate protocol. Ensure the categoryView is correctly bound to the pagerView's listContainerView. ```objectivec // PagingViewController.h #import #import "JXPagerView.h" #import "JXCategoryTitleView.h" @interface PagingViewController : UIViewController @end // PagingViewController.m #import "PagingViewController.h" #import "ListViewController.h" static const NSUInteger kHeaderHeight = 200; static const NSUInteger kCategoryHeight = 44; @interface PagingViewController () @property (nonatomic, strong) JXPagerView *pagerView; @property (nonatomic, strong) JXCategoryTitleView *categoryView; @property (nonatomic, copy) NSArray *titles; @end @implementation PagingViewController - (void)viewDidLoad { [super viewDidLoad]; self.titles = @[@"动态", @"文章", @"喜欢"]; // 1. 配置 categoryView self.categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, kCategoryHeight)]; self.categoryView.titles = self.titles; // 2. 初始化 JXPagerView(指定使用 UIScrollView 容器) self.pagerView = [[JXPagerView alloc] initWithDelegate:self listContainerType:JXPagerListContainerTypeScrollView]; self.pagerView.frame = self.view.bounds; [self.view addSubview:self.pagerView]; // 3. ⚠️ 关键:绑定 listContainerView 与 categoryView self.categoryView.listContainer = (id)self.pagerView.listContainerView; // 4. 指定默认选中 index self.pagerView.defaultSelectedIndex = 0; self.categoryView.defaultSelectedIndex = 0; } #pragma mark - JXPagerViewDelegate - (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView { return kHeaderHeight; } - (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView { UIImageView *headerView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, kHeaderHeight)]; headerView.image = [UIImage imageNamed:@"profile_header"]; headerView.contentMode = UIViewContentModeScaleAspectFill; headerView.clipsToBounds = YES; return headerView; } - (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView { return kCategoryHeight; } - (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView { return self.categoryView; } - (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView { return self.titles.count; } - (id)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index { ListViewController *listVC = [[ListViewController alloc] init]; listVC.category = self.titles[index]; return listVC; } // 可选:主列表滚动回调 - (void)pagerView:(JXPagerView *)pagerView mainTableViewDidScroll:(UIScrollView *)scrollView { CGFloat alpha = MIN(1.0, scrollView.contentOffset.y / kHeaderHeight); self.navigationController.navigationBar.alpha = alpha; } @end ``` -------------------------------- ### Configure JXCategoryTitleView Properties Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Examples/JXPagerViewExample-OC/Pods/JXCategoryView/README.md Sets the titles for the category view and enables title color gradient. Ensure titles are provided as an array. ```Objective-C self.categoryView.titles = @[@"螃蟹", @"麻辣小龙虾", @"苹果"]; self.categoryView.titleColorGradientEnabled = YES; ``` -------------------------------- ### Handle Header Scaling with Main List Scroll Callback Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt Implement header image scaling by listening to the main list's scroll callback. When the content offset is less than zero, stretch the header image to create a pull-to-zoom effect. Ensure the `scrollViewDidScroll` event is correctly passed back in `listViewDidScrollCallback` for proper linkage. ```swift func pagingView(_ pagingView: JXPagingView, mainTableViewDidScroll scrollView: UIScrollView) { headerView.scrollViewDidScroll(scrollView.contentOffset.y) } ``` ```swift class ZoomHeaderView: UIView { var imageView: UIImageView! let imageHeight: CGFloat = 200 func scrollViewDidScroll(_ offsetY: CGFloat) { if offsetY < 0 { // Downward zoom: scale using transform or frame modification let scale = 1 + (-offsetY / imageHeight) let newHeight = imageHeight * scale imageView.frame = CGRect( x: -(newHeight - bounds.width) / 2, y: offsetY, width: newHeight, height: newHeight ) } else { imageView.frame = CGRect(x: 0, y: 0, width: bounds.width, height: imageHeight) } } } ``` -------------------------------- ### Implement JXCategoryListContainerViewDelegate Methods Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Examples/JXPagerViewExample-OC/Pods/JXCategoryView/README.md Required delegate methods for JXCategoryListContainerView. Implement `numberOfListsInlistContainerView` to return the count of lists and `listContainerView:initListForIndex:` to provide list instances. ```Objective-C //返回列表的数量 - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView { return self.titles.count; } //根据下标index返回对应遵从`JXCategoryListContentViewDelegate`协议的列表实例 - (id)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index { return [[ListViewController alloc] init]; } ``` -------------------------------- ### Implement JXPagingViewListViewDelegate in Swift Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt Implement this protocol for all sub-lists. Ensure listViewDidScrollCallback is correctly implemented for smooth scrolling synchronization. ```swift class FeedListViewController: UIViewController, JXPagingViewListViewDelegate { var tableView: UITableView! var scrollCallback: ((UIScrollView) -> Void)? var category: String = "" override func loadView() { // ⚠️ 列表用 UIViewController 封装且要支持横竖屏时,必须加此行 self.view = UIView() } override func viewDidLoad() { super.viewDidLoad() tableView = UITableView(frame: view.bounds, style: .plain) tableView.delegate = self tableView.dataSource = self view.addSubview(tableView) } // MARK: - JXPagingViewListViewDelegate /// 返回列表视图(VC 包裹返回 vc.view,自定义 View 返回自身) func listView() -> UIView { return view } /// 返回列表内部持有的 UIScrollView / UITableView / UICollectionView func listScrollView() -> UIScrollView { return tableView } /// ⚠️ 核心方法:将列表的 scrollViewDidScroll 事件通过 callback 回传给 JXPagingView func listViewDidScrollCallback(callback: @escaping (UIScrollView) -> Void) { self.scrollCallback = callback } /// 列表显示时回调(可选) func listDidAppear() { print("\(category) 列表已显示") } /// 列表消失时回调(可选) func listDidDisappear() { print("\(category) 列表已消失") } } // MARK: - UITableViewDelegate extension FeedListViewController: UITableViewDelegate { func scrollViewDidScroll(_ scrollView: UIScrollView) { // ⚠️ 必须调用 scrollCallback,将滚动事件传给 JXPagingView scrollCallback?(scrollView) } } ``` -------------------------------- ### JXCategoryCollectionView:处理分类视图手势 Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Document/全屏手势处理.md 在分类视图的代理方法中实现手势同时识别逻辑。当分类视图内容偏移量小于等于0时,允许识别全屏手势,确保手势在滚动和分类视图之间顺畅切换。 ```Objective-C - (BOOL)categoryCollectionView:(JXCategoryCollectionView *)collectionView gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { if (collectionView.contentOffset.x <= 0) { if ([otherGestureRecognizer.delegate isKindOfClass:NSClassFromString(@ ``` -------------------------------- ### JXCategoryCollectionView:设置手势代理 Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Document/全屏手势处理.md 将JXCategoryCollectionView的`gestureDelegate`设置为当前视图控制器,以启用自定义的手势识别逻辑。这是集成全屏手势的必要配置。 ```Objective-C self.categoryView.collectionView.gestureDelegate = self ``` -------------------------------- ### Configure Inner PagingView for Nested Scrolling Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt Set up an inner PagingView within a view controller to support nested scrolling. This involves initializing the JXPagingView, enabling nested paging gestures, and correctly implementing the `JXPagingViewListViewDelegate` methods to ensure proper scroll event handling and list container binding. ```swift class InnerTabViewController: UIViewController, JXPagingViewListViewDelegate { var innerPagingView: JXPagingView! override func viewDidLoad() { super.viewDidLoad() innerPagingView = JXPagingView(delegate: self) // ⚠️ Enable nested paging gesture support // Allow outer PagingView to take over left/right swipes when inner view scrolls to boundary innerPagingView.listContainerView.isCategoryNestPagingEnabled = true innerPagingView.frame = view.bounds view.addSubview(innerPagingView) } // Implement JXPagingViewListViewDelegate func listView() -> UIView { return view } func listScrollView() -> UIScrollView { return innerPagingView.mainTableView } func listViewDidScrollCallback(callback: @escaping (UIScrollView) -> Void) { // Pass the outer scrollCallback to the inner mainTableView's scroll event innerPagingView.mainTableView.scrollCallback = callback } } ``` -------------------------------- ### JXPagerView:自定义ScrollView类 Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Document/全屏手势处理.md 为JXPagerView指定一个自定义的ScrollView类,以便在其内部实现手势代理方法。此设置是集成全屏手势的关键一步。 ```Objective-C - (Class)scrollViewClassInlistContainerViewInPagerView:(JXPagerView *)pagerView { return [FullScreenGestureScrollView class]; } ``` -------------------------------- ### FullScreenGestureScrollView:处理ScrollView手势 Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Document/全屏手势处理.md 在自定义的ScrollView类中实现手势代理方法,以允许全屏滑动返回手势与ScrollView的滚动同时识别。当ScrollView内容偏移量小于等于0时,允许识别全屏手势。 ```Objective-C - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { if (collectionView.contentOffset.x <= 0) { if ([otherGestureRecognizer.delegate isKindOfClass:NSClassFromString(@ ``` -------------------------------- ### Gesture Conflict Handling Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt When nesting pages with system back gestures or `FDFullscreenPopGesture`, it's necessary to handle gesture conflicts to ensure the back gesture can be triggered when the list scrolls to the first tab. ```APIDOC ## 侧滑手势兼容处理 当页面嵌套使用系统侧滑返回或 `FDFullscreenPopGesture` 时,需处理手势冲突,确保列表滚动到第一个 tab 时可以触发侧滑返回。 ```swift override func viewDidLoad() { super.viewDidLoad() // 将侧滑手势代理设为当前 VC navigationController?.interactivePopGestureRecognizer?.delegate = self } // MARK: - UIGestureRecognizerDelegate extension ProfileViewController: UIGestureRecognizerDelegate { func gestureRecognizer( _ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer ) -> Bool { // 当 JXPagingView 的列表滚到最左边时,允许侧滑手势同时响应 if String(describing: otherGestureRecognizer.view.self).contains("JXPagingView"), let scrollView = otherGestureRecognizer.view as? UIScrollView { if scrollView.contentOffset.x <= 0 { return true } } return false } } ``` ``` -------------------------------- ### resizeTableHeaderViewHeight Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt `resizeTableHeaderViewHeight` allows for runtime updates to the HeaderView's height with optional animation, useful for expanding/collapsing content like user profiles. ```APIDOC ## resizeTableHeaderViewHeight — 动态修改 HeaderView 高度 `resizeTableHeaderViewHeight` 用于在运行时更新顶部 HeaderView 的高度,支持带动画过渡,适用于展开/收起用户简介等场景。 ```swift // 不带动画(立即生效) pagingView.resizeTableHeaderViewHeight() // 带动画(展开个人简介后更新高度) func expandBio() { isBioExpanded = true // delegate 的 tableHeaderViewHeight 返回值已更新 pagingView.resizeTableHeaderViewHeight( animatable: true, duration: 0.3, curve: .easeInOut ) } ``` ``` -------------------------------- ### Dynamically Resize Header View Height Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt Use `resizeTableHeaderViewHeight` to update the header view's height at runtime, with optional animation. This is useful for expanding/collapsing user bios. ```swift // 不带动画(立即生效) pagingView.resizeTableHeaderViewHeight() ``` ```swift // 带动画(展开个人简介后更新高度) func expandBio() { isBioExpanded = true // delegate 的 tableHeaderViewHeight 返回值已更新 pagingView.resizeTableHeaderViewHeight( animatable: true, duration: 0.3, curve: .easeInOut ) } ``` -------------------------------- ### Handle Side-Slip Gesture Compatibility Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt To ensure side-slip gestures (system or `FDFullscreenPopGesture`) work correctly when nested, configure the gesture recognizer delegate. This allows side-slip to trigger when the list scrolls to the first tab. ```swift override func viewDidLoad() { super.viewDidLoad() // 将侧滑手势代理设为当前 VC navigationController?.interactivePopGestureRecognizer?.delegate = self } ``` ```swift // MARK: - UIGestureRecognizerDelegate extension ProfileViewController: UIGestureRecognizerDelegate { func gestureRecognizer( _ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer ) -> Bool { // 当 JXPagingView 的列表滚到最左边时,允许侧滑手势同时响应 if String(describing: otherGestureRecognizer.view.self).contains("JXPagingView"), let scrollView = otherGestureRecognizer.view as? UIScrollView { if scrollView.contentOffset.x <= 0 { return true } } return false } } ``` -------------------------------- ### Add Indicator to JXCategoryTitleView Source: https://github.com/pujiaxin33/jxpagingview/blob/master/Examples/JXPagerViewExample-OC/Pods/JXCategoryView/README.md Adds a JXCategoryIndicatorLineView as an indicator to the category view. Customize the indicator's color and width. ```Objective-C JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init]; lineView.indicatorLineViewColor = [UIColor redColor]; lineView.indicatorLineWidth = JXCategoryViewAutomaticDimension; self.categoryView.indicators = @[lineView]; ``` -------------------------------- ### JXPagingListRefreshView Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt `JXPagingListRefreshView` is a subclass of `JXPagingView` designed for scenarios requiring pull-to-refresh functionality within the list itself, not for the entire page. Usage is identical to `JXPagingView`, simply by changing the class name. ```APIDOC ## JXPagingListRefreshView — 支持列表下拉刷新 `JXPagingListRefreshView` 是 `JXPagingView` 的子类,专门用于**列表自身下拉刷新**的场景(而非首页整体下拉刷新)。使用方式与 `JXPagingView` 完全一致,替换类名即可。 ```swift // 将 JXPagingView 替换为 JXPagingListRefreshView pagingView = JXPagingListRefreshView(delegate: self, listContainerType: .scrollView) pagingView.frame = view.bounds view.addSubview(pagingView) // 在列表内配置 MJRefresh 下拉刷新 class RefreshListViewController: UIViewController, JXPagingViewListViewDelegate { var tableView: UITableView! var scrollCallback: ((UIScrollView) -> Void)? override func viewDidLoad() { super.viewDidLoad() tableView = UITableView(frame: view.bounds) // 添加 MJRefresh 下拉刷新(与 JXPagingListRefreshView 兼容) tableView.mj_header = MJRefreshNormalHeader { [weak self] in // 加载数据 DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { self?.tableView.mj_header?.endRefreshing() } } view.addSubview(tableView) } func listView() -> UIView { return view } func listScrollView() -> UIScrollView { return tableView } func listViewDidScrollCallback(callback: @escaping (UIScrollView) -> Void) { self.scrollCallback = callback } } extension RefreshListViewController: UIScrollViewDelegate { func scrollViewDidScroll(_ scrollView: UIScrollView) { scrollCallback?(scrollView) } } ``` ``` -------------------------------- ### Access Loaded List Instances via validListDict Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt `validListDict` is a dictionary storing all loaded list instances, keyed by their index. This allows direct manipulation of specific lists, such as forcing a data refresh. ```swift // 获取当前已加载的第0个列表并刷新 if let list = pagingView.validListDict[0] as? FeedListViewController { list.refreshData() } ``` ```swift // 遍历所有已加载列表,触发滚动到顶部 for (_, list) in pagingView.validListDict { list.listScrollView().setContentOffset(.zero, animated: true) } ``` ```objective-c // OC 版本 FeedListViewController *firstList = self.pagerView.validListDict[@(0)]; [firstList refreshData]; ``` -------------------------------- ### validListDict Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt `validListDict` is a dictionary that stores all loaded list instances (keyed by index). This allows for direct manipulation of specific lists, such as forcing a refresh of data for a particular tab. ```APIDOC ## validListDict — 访问已加载的列表实例 `validListDict` 字典存储了所有已加载的列表实例(key 为 index),可用于主动操作特定列表(如强制刷新某个 tab 的数据)。 ```swift // 获取当前已加载的第0个列表并刷新 if let list = pagingView.validListDict[0] as? FeedListViewController { list.refreshData() } // 遍历所有已加载列表,触发滚动到顶部 for (_, list) in pagingView.validListDict { list.listScrollView().setContentOffset(.zero, animated: true) } // OC 版本 FeedListViewController *firstList = self.pagerView.validListDict[@(0)]; [firstList refreshData]; ``` ``` -------------------------------- ### JXPagingListRefreshView for List Pull-to-Refresh Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt `JXPagingListRefreshView` is a subclass of `JXPagingView` designed for scenarios where the list itself supports pull-to-refresh. Usage is identical to `JXPagingView`, simply replace the class name. ```swift // 将 JXPagingView 替换为 JXPagingListRefreshView pagingView = JXPagingListRefreshView(delegate: self, listContainerType: .scrollView) pagingView.frame = view.bounds view.addSubview(pagingView) ``` ```swift // 在列表内配置 MJRefresh 下拉刷新 class RefreshListViewController: UIViewController, JXPagingViewListViewDelegate { var tableView: UITableView! var scrollCallback: ((UIScrollView) -> Void)? override func viewDidLoad() { super.viewDidLoad() tableView = UITableView(frame: view.bounds) // 添加 MJRefresh 下拉刷新(与 JXPagingListRefreshView 兼容) tableView.mj_header = MJRefreshNormalHeader { [weak self] in // 加载数据 DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { self?.tableView.mj_header?.endRefreshing() } } view.addSubview(tableView) } func listView() -> UIView { return view } func listScrollView() -> UIScrollView { return tableView } func listViewDidScrollCallback(callback: @escaping (UIScrollView) -> Void) { self.scrollCallback = callback } } extension RefreshListViewController: UIScrollViewDelegate { func scrollViewDidScroll(_ scrollView: UIScrollView) { scrollCallback?(scrollView) } } ``` -------------------------------- ### Reload Data in JXPagingView Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt Use `reloadData` to dynamically update all content in `pagingView`. This clears cached lists and re-triggers the delegate method. It's effective with `allowsCacheList` and `listIdentifierAtIndex` for list reuse. ```swift func updateTabs(newTitles: [String]) { self.titles = newTitles // 同步更新 segmentedView segmentedDataSource.titles = newTitles segmentedView.reloadData() // 刷新 pagingView pagingView.reloadData() } ``` ```swift pagingView.allowsCacheList = true ``` ```swift func pagingView(_ pagingView: JXPagingView, listIdentifierAtIndex index: Int) -> String? { return titles[index] // 用标题作为唯一标识 } ``` -------------------------------- ### defaultSelectedIndex Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt `defaultSelectedIndex` sets the initial index of the displayed list. This should be synchronized with the `defaultSelectedIndex` of the category selector. ```APIDOC ## defaultSelectedIndex — 指定默认选中的列表 `defaultSelectedIndex` 用于设置初始显示的列表 index,需与分类选择器的 `defaultSelectedIndex` 保持一致。 ```swift // 默认显示第2个列表(index 从0开始) pagingView.defaultSelectedIndex = 2 segmentedView.defaultSelectedIndex = 2 // OC 版本 self.pagerView.defaultSelectedIndex = 2; self.categoryView.defaultSelectedIndex = 2; ``` ``` -------------------------------- ### pinSectionHeaderVerticalOffset Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt `pinSectionHeaderVerticalOffset` controls the vertical offset of the sticky section header view from the top. Increasing this value moves the header further down, often used to reserve space below a navigation bar. ```APIDOC ## pinSectionHeaderVerticalOffset — 悬浮 Header 垂直偏移 `pinSectionHeaderVerticalOffset` 控制悬浮分类 HeaderView 距顶部的偏移量,数值越大越往下沉。常用于在导航栏下方留出空间。 ```swift // 悬浮 Header 在导航栏下方显示(状态栏44 + 导航栏44 = 88,但通常设为导航栏高度即可) pagingView.pinSectionHeaderVerticalOffset = Int(navigationController!.navigationBar.frame.maxY) // OC 版本 self.pagerView.pinSectionHeaderVerticalOffset = (NSInteger)CGRectGetMaxY(self.navigationController.navigationBar.frame); ``` ``` -------------------------------- ### Enable Nested Paging Gestures in Inner PagingView Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt Enable nested paging gesture support to allow the outer PagingView to take over left and right swipes when the inner view reaches its boundary. This is crucial for handling gesture conflicts in multi-level PagingView nesting. ```swift innerPagingView.listContainerView.isCategoryNestPagingEnabled = true ``` -------------------------------- ### reloadData Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt `reloadData` dynamically updates the entire content of pagingView, clearing cached lists and re-triggering the delegate method. It supports list reuse with `allowsCacheList` and `listIdentifierAtIndex` to prevent duplicate creations. ```APIDOC ## reloadData — 刷新数据 `reloadData` 用于动态更新 pagingView 的全部内容,会清空已加载的列表缓存并重新触发代理方法。配合 `allowsCacheList` 和 `listIdentifierAtIndex` 可实现列表复用,避免重复创建。 ```swift // 动态更新标签数量后刷新 func updateTabs(newTitles: [String]) { self.titles = newTitles // 同步更新 segmentedView segmentedDataSource.titles = newTitles segmentedView.reloadData() // 刷新 pagingView pagingView.reloadData() } // 开启列表缓存复用(适用于标签动态增减但内容可复用的场景) pagingView.allowsCacheList = true // 同时需实现 listIdentifierAtIndex 提供唯一标识 func pagingView(_ pagingView: JXPagingView, listIdentifierAtIndex index: Int) -> String? { return titles[index] // 用标题作为唯一标识 } ``` ``` -------------------------------- ### Set Default Selected Index Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt Use `defaultSelectedIndex` to specify the initially displayed list index. This should match the `defaultSelectedIndex` of the category selector. ```swift // 默认显示第2个列表(index 从0开始) pagingView.defaultSelectedIndex = 2 segmentedView.defaultSelectedIndex = 2 ``` ```objective-c // OC 版本 self.pagerView.defaultSelectedIndex = 2; self.categoryView.defaultSelectedIndex = 2; ``` -------------------------------- ### Set Pinned Section Header Vertical Offset Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt Configure `pinSectionHeaderVerticalOffset` to control the vertical offset of the pinned section header view from the top. A larger value causes it to appear lower. ```swift // 悬浮 Header 在导航栏下方显示(状态栏44 + 导航栏44 = 88,但通常设为导航栏高度即可) pagingView.pinSectionHeaderVerticalOffset = Int(navigationController!.navigationBar.frame.maxY) ``` ```objective-c // OC 版本 self.pagerView.pinSectionHeaderVerticalOffset = (NSInteger)CGRectGetMaxY(self.navigationController.navigationBar.frame); ``` -------------------------------- ### Control List Horizontal Scrolling Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt The `isListHorizontalScrollEnabled` property determines if sub-lists can be scrolled horizontally. The default value is `true`. ```swift // 禁止左右滑动(仅允许点击 tab 切换) pagingView.isListHorizontalScrollEnabled = false ``` ```objective-c // OC 版本 self.pagerView.isListHorizontalScrollEnabled = NO; ``` -------------------------------- ### isListHorizontalScrollEnabled Source: https://context7.com/pujiaxin33/jxpagingview/llms.txt The `isListHorizontalScrollEnabled` property determines whether the child lists within pagingView can be scrolled horizontally to switch tabs. It defaults to `true`. ```APIDOC ## isListHorizontalScrollEnabled — 控制列表左右滑动 通过 `isListHorizontalScrollEnabled` 属性控制子列表是否允许左右滑动切换,默认为 `true`。 ```swift // 禁止左右滑动(仅允许点击 tab 切换) pagingView.isListHorizontalScrollEnabled = false // OC 版本 self.pagerView.isListHorizontalScrollEnabled = NO; ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.