Latest 1.0.0
Homepage https://github.com/ButtFly/Separator
License MIT
Platforms ios 7.0, requires ARC
Authors

CI Status
Version
License
Platform

Usage

详细的使用见 demo,因为最近比较忙,所以实现的功能不是很全面,如果您有更好的建议,请联系我。

  • LYSeparatorRelation

LYSeparatorHorizontalTopSpace,          //水平画线,据顶部一定距离
LYSeparatorHorizontalCenterSpace,       //水平画线,据竖直中心一定距离LYSeparatorHorizontalBottomSpace,       //水平画线,据底部一定距离LYSeparatorVerticalLeftSpace,           //竖直画线,据左边一定距离
LYSeparatorVerticalCenterSpace,         //竖直画线,据水平中心一定距离
LYSeparatorVerticalRightSpace,          //竖直画线,据右边一定距离
LYSeparatorHorizontalTopRatio,          //水平画线,据顶部以高为基准的一定比例
LYSeparatorVerticalLeftRatio,           //竖直画线,据左边以宽为基准的一定比例

*   建立一个分隔线

LYSeparatorDescription *des = [LYSeparatorDescription separatorWithName:@"custom des"];
des.stokeColor = [UIColor redColor];
des.stokeStart = 0.2;
des.stokeEnd = 0.9;
des.relation = LYSeparatorVerticalLeftRatio;
des.constant = 0.5;
[view addSeparator:des];        

*   封装了添加一些基本的分隔线

[view addCellSeparator];        //添加类似 cell 的分隔线
[view addTopSeparatorWithEdge:edge color:color]; //添加距离顶部 edge,颜色为 color 的水平分隔线
......

*   添加自定义的 UIPath,你对 LYSeparatorDescription 的改变能立即表现在视图上(目前没有加入动画的支持)

LYSeparatorDescription *pathDes = [LYSeparatorDescription separatorWithName:@"path des"];
pathDes.stokeColor = [UIColor redColor];
pathDes.stokeStart = 0.2;
pathDes.stokeEnd = 0.9;
pathDes.stokePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 300, 50) cornerRadius:6];
[self performSelector:@selector(changeSeparator:) withObject:des afterDelay:3];
[view addSeparator:pathDes];

*   添加自定义的图片,采用了 CAReplicatorLayer

LYSeparatorDescription *cusDes2 = [LYSeparatorDescription separatorWithName:@"custom des 2"];

UIImageView *imageV2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 100, 20, 20)];
imageV2.image = [UIImage imageNamed:@"2"];
cusDes2.customView = imageV2;
cusDes2.instanceCount = 20;
cusDes2.instanceTransform = CATransform3DMakeTranslation(20, 0, 0);
[view addSeparator:cusDes2];

*   因为 CAReplicatorLayer 是支持动画的,所以你也可以用自己的方式添加动画

LYSeparatorDescription *cusDes = [LYSeparatorDescription separatorWithName:@"custom des"];
UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
imageV.image = [UIImage imageNamed:@"1"];
cusDes.customView = imageV;
cusDes.instanceCount = 20;
cusDes.instanceDelay = 0.2;

CAKeyframeAnimation *an = [CAKeyframeAnimation animationWithKeyPath:@"position"];
UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(10, 10)];
[path addLineToPoint:CGPointMake(200, 30)];
[path addLineToPoint:CGPointMake(300, 300)];
[path closePath];
an.path = [path CGPath];
an.repeatCount = MAXFLOAT;
an.duration = 4;
[imageV.layer addAnimation:an forKey:@"an"];
[view addSeparator:cusDes];

Requirements

XCode 7以上

Installation

Separator is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "Separator"

Author

余河川, [email protected]

License

Separator is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Separator",
    "version": "1.0.0",
    "summary": "u4e00u4e2au8f7bu91cfu7ea7u7684u4e3au89c6u56feu6dfbu52a0u5206u5272u7ebfu7684u5de5u5177.",
    "description": "u4e00u4e2au8f7bu91cfu7ea7u7684u4e3au89c6u56feu6dfbu52a0u5206u5272u7ebfu7684u5de5u5177uff0cu65b9u4fbfu5728u9879u76eeu4e2du6dfbu52a0u5404u79cdu5206u5272u7ebfuff0cu4ee5u8fbeu5230u8bbeu8ba1u60f3u8981u7684u6548u679c",
    "homepage": "https://github.com/ButtFly/Separator",
    "license": "MIT",
    "authors": {
        "u4f59u6cb3u5ddd": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ButtFly/Separator.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "Separator": [
            "Pod/Assets/*.png"
        ]
    }
}

Pin It on Pinterest

Share This