美文网首页
OC-地图视图抽屉工具:SegmentBoxView

OC-地图视图抽屉工具:SegmentBoxView

作者: LiYaoPeng | 来源:发表于2024-03-02 00:58 被阅读0次
    SegmentBoxView.gif

    一、 SegmentBoxView 结构

    image.png

    二、 SegmentBoxView 使用

    1、 自定义SegmentBoxViewController 子类

    2、 设置子类属性 scrollViewVcbackgroundVc

    3、 设置boxViewscrollViewVcbackgroundVcframe

    4、 设置boxViewconfig,调整a/b/c/d/e线的位置

    4、 调用[self.boxView reloadUI]; 刷新UI

    三、 吸附线相关设置

    代码示例:

    self.boxView.config.segmentPointY_A = 100;// a线
    self.boxView.config.segmentPointY_C = self.view.frame.size.height * 0.3;//C线
    self.boxView.config.segmentPointSpaceE_F = 300;//e线
    [self.boxView reloadUI];
    

    结构

    /*
     ______________________________> boxView 顶部
     |           ↓           |
     |—————— top吸附点 ———————|——a——> realSegmentPointY_A
     |           ↑           |
     |           ↑           |
     |           ↑           |
     |-----------------------|--b--> realsegmentPointSpace_A_C
     |           ↓           |
     |—————— mid吸附点 ———————|——c——> segmentPointY_C
     |           ↑           |
     |-----------------------|--d--> segmentPointY_D
     |           ↓           |
     |           ↓           |
     |           ↓           |
     |                       |
     |———— bottom吸附点 ——————|——e——> realSegmentPointY_E
     |           ↑           |
     |           ↑           |
     |           ↑           |
     |_______________________|——f——> boxView 底部
     * 1、 ↑↓: 吸附点流向
     * 2、 [a,b) 吸附 realSegmentPointY_A
     * 3、 [b,d] 吸附 segmentPointY_C
     * 4、 (d,f] 吸附 realSegmentPointY_E
     */
    

    属性

    属性 类型 读写权限 描述
    segmentPointY_A CGFloat Read/Write scrollContainerView顶部吸附的距离,默认为0。应小于 segmentPointY_C。当segmentPointY_A == segmentPointY_C时,segmentPointY_C即为top吸附,状态为 SegmentBoxViewFixedPointStatus_c
    realSegmentPointY_A CGFloat Read-Only 计算后的 segmentPointY_A
    segmentPointSpace_A_C CGFloat Read/Write c线的上吸附范围,默认为100。
    realSegmentPointY_B CGFloat Read-Only a线与b线的最大y值,注意a线与b线的关系。
    segmentPointY_C CGFloat Read/Write mid吸附点c线的默认值,为self.frame.size.height * 0.3
    segmentPointSpace_C_D CGFloat Read/Write c线的下吸附范围,默认为100。
    realSegmentPointY_D CGFloat Read-Only e线与d线的最小y值,注意e线与d线的关系。
    realSegmentPointY_E CGFloat Read-Only self.height - segmentPointSpaceE_F与c线的最大y值,注意e线与c线的关系。
    segmentPointSpaceE_F CGFloat Read/Write e线到f线的距离,默认为200。
    ePullUpTopSpace CGFloat Read/Write 手势向上拉时,e线到超过这个距离就会吸附到c线。即boxView.frame.size.height - self.config.segmentPointSpaceE_F + self.config.ePullUpTopSpace,默认为100。
    verticalOffset CGFloat Read/Write 手势垂直判定方向的滚动距离,默认为10。
    isShowDebugLine BOOL Read/Write 是否展示辅助线,默认为NO

    四、demo

    https://github.com/LiPengYue/SegmentBoxView.git

    相关文章

      网友评论

          本文标题:OC-地图视图抽屉工具:SegmentBoxView

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