美文网首页ios开发iOS 开发基础iOS
tableView嵌套tableView 支持左右滑动 上下联

tableView嵌套tableView 支持左右滑动 上下联

作者: JCtop | 来源:发表于2017-06-23 16:42 被阅读510次

之前的那版,刚发布,马上就有朋友给出了宝贵意见。不得不说,与人分享是一件令人高兴的事。^-^

这不今天得空,就将原来的封装了一下。自我感觉还可以,如有不足,还希望各位朋友能不吝赐教;

实现这个功能其实很简单,只要俩步:

First of all  ,将demo下载下来,将HSFTableView文件夹 拖入您的工程

demo目录结构 目录结构

第二步,  自定义一个控制器继承于 HSFNestVC ,在viewDidLoad里添加:

控制器继承于 HSFNestVC

【注意】VC1  VC2  VC3  要继承与HSFBaseTableVC

Finally,  就这样 完了。 简单吧。赶快试试吧^-^

demo地址: https://github.com/SeriouslyFunny/HSFTableViewDemo

相关文章

网友评论

  • LiYaoPeng:额 兄弟 有内存泄露 MLMSegmentManager.m 里面需要把header 弱引用

    //
    // MLMSegmentManager.m
    // MLMSegmentPage
    //
    // Created by my on 2017/2/5.
    // Copyright © 2017年 my. All rights reserved.
    //

    #import "MLMSegmentManager.h"

    @implementation MLMSegmentManager

    + (void)associateHead:(MLMSegmentHead *)head
    withScroll:(MLMSegmentScroll *)scroll
    completion:(void(^)())completion {
    [MLMSegmentManager associateHead:head withScroll:scroll completion:completion selectEnd:nil];
    }

    + (void)associateHead:(MLMSegmentHead *)head
    withScroll:(MLMSegmentScroll *)scroll
    completion:(void(^)())completion
    selectEnd:(void(^)(NSInteger index))selectEnd {
    NSInteger showIndex;
    showIndex = head.showIndex?head.showIndex:scroll.showIndex;
    head.showIndex = scroll.showIndex = showIndex;

    head.selectedIndex = ^(NSInteger index) {
    [scroll setContentOffset:CGPointMake(index*scroll.width, 0) animated:YES];
    if (selectEnd) {
    selectEnd(index);
    }
    };
    [head defaultAndCreateView];

    __weak typeof(head) weakHead = head;

    scroll.scrollEnd = ^(NSInteger index) {
    [weakHead setSelectIndex:index];
    if (selectEnd) {
    selectEnd(index);
    }
    };
    scroll.animationEnd = ^(NSInteger index) {
    [weakHead animationEnd];
    };
    scroll.offsetScale = ^(CGFloat scale) {
    [weakHead changePointScale:scale];
    };

    if (completion) {
    completion();
    }
    [scroll createView];

    UIView *view = head.nextResponder?head:scroll;
    UIViewController *currentVC = [view viewController];
    currentVC.automaticallyAdjustsScrollViewInsets = NO;
    }
    - (void)dealloc {
    NSLog(@"✅%@",NSStringFromClass([self class]));
    }

    @end
  • 583a28b22745:最后一行不显示 是怎么回事
  • 安浪创想:悬浮这个tab怎么换成下拉筛选的功能,有没有这样的Demo呢

本文标题:tableView嵌套tableView 支持左右滑动 上下联

本文链接:https://www.haomeiwen.com/subject/xpvccxtx.html