Latest 1.1.0
Homepage https://github.com/IntrepidPursuits/IPDashedLineView
License MIT Copyright (C) 2012 by Intrepid Pursuits

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Platforms ios 6.1, requires ARC
Authors

IPDashedLineView provides a simple interface for creating dashed lines. It can be instantiated in code with -initWithFrame: or in a nib.

Screenshot

Example Usage

// Forced Horizontal
IPDashedLineView *dash1 = [[IPDashedLineView alloc] initWithFrame:CGRectMake(20, 60, 200, 1)];
dash1.direction = IPDashedLineViewDirectionHorizontalFromRight;
dash1.lineColor = [UIColor blackColor];
dash1.lengthPattern = @[@1, @1];
[self.view addSubview:dash1];

// Vertical
IPDashedLineView *dash2 = [[IPDashedLineView alloc] initWithFrame:CGRectMake(20, 100, 4, 200)];
dash2.lengthPattern = @[@4, @4];
dash2.lineColor = [UIColor orangeColor];
[self.view addSubview:dash2];

// Horizontal
IPDashedLineView *dash3 = [[IPDashedLineView alloc] initWithFrame:CGRectMake(40, 100, 200, 4)];
dash3.lengthPattern = @[@2, @4];
dash3.lineColor = [UIColor greenColor];
[self.view addSubview:dash3];

// Forced Vertical
IPDashedLineView *dash4 = [[IPDashedLineView alloc] initWithFrame:CGRectMake(40, 300, 6, 200)];
dash4.lengthPattern = @[@1, @1, @10, @1, @1, @6,];
dash4.phase = 7;
dash4.lineColor = [UIColor redColor];
dash4.backgroundColor = [UIColor blueColor];
dash4.direction = IPDashedLineViewDirectionVerticalFromBottom;
[self.view addSubview:dash4];

// Forced Vertical (looks like a bunch of horizontal lines)
IPDashedLineView *dash5 = [[IPDashedLineView alloc] initWithFrame:CGRectMake(60, 300, 200, 20)];
dash5.lengthPattern = @[@1, @1];
dash5.lineColor = [UIColor purpleColor];
dash5.direction = IPDashedLineViewDirectionVerticalFromTop;
[self.view addSubview:dash5];

// Bordered View
IPDashedBorderedView *borderedView1 = [[IPDashedBorderedView alloc] initWithFrame:CGRectMake(60, 140, 200, 100)];
borderedView1.borderWidth = 5;
borderedView1.lineColor = [UIColor orangeColor];
borderedView1.lengthPattern = @[@5, @5];
borderedView1.backgroundColor = [UIColor blueColor];
[self.view addSubview:borderedView1];

// Bordered View
IPDashedBorderedView *borderedView2 = [[IPDashedBorderedView alloc] initWithFrame:CGRectMake(120, 180, 40, 40)];
borderedView2.borderWidth = 1;
borderedView2.lineColor = [UIColor whiteColor];
borderedView2.lengthPattern = @[@1, @1];
borderedView2.backgroundColor = [UIColor clearColor];
[self.view addSubview:borderedView2];

// Bordered View
IPDashedBorderedView *borderedView3 = [[IPDashedBorderedView alloc] initWithFrame:CGRectMake(180, 180, 40, 40)];
borderedView3.borderWidth = 1;
borderedView3.lineColor = [UIColor lightGrayColor];
borderedView3.lengthPattern = @[@1, @3];
borderedView3.backgroundColor = [UIColor clearColor];
[self.view addSubview:borderedView3];

Latest podspec

{
    "name": "IPDashedLineView",
    "version": "1.1.0",
    "summary": "Simple dashed lines.",
    "homepage": "https://github.com/IntrepidPursuits/IPDashedLineView",
    "license": {
        "type": "MIT",
        "text": "      Copyright (C) 2012 by Intrepid Pursuitsnn      Permission is hereby granted, free of charge, to any person obtaining a copy of this softwaren      and associated documentation files (the "Software"), to deal in the Software withoutn      restriction, including without limitation the rights to use, copy, modify, merge, publish,n      distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom then      Software is furnished to do so, subject to the following conditions:nn      The above copyright notice and this permission notice shall be included in all copies orn      substantial portions of the Software.nn      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDINGn      BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE ANDn      NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,n      DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,n      OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.n"
    },
    "authors": {
        "Colin Brash": "[email protected]"
    },
    "source": {
        "git": "https://github.com/IntrepidPursuits/IPDashedLineView.git",
        "tag": "1.1.0"
    },
    "platforms": {
        "ios": "6.1"
    },
    "source_files": "Code/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This