iOS UIView with dashed or solid line border.
You may use the LBorderView class files in your project directly, or you may follow the steps below to clone the repo and use it as static library in your project.
Integrating into your project as static library
- clone the LBorderView git repository e.g. git clone git://github.com/lukagabric/LBorderView.git
- add LBorderView.xcodeproj to your project, make sure "Copy items into ..." is unchecked
- in your target's Build Phases, under Link Binary With Libraries, click on the (+) and add the libLBorderView.a library, CoreGraphics.framework and QuartzCore.framework.
- add the relative path to the LBorderView header in your "User Header Search Path" Build Setting
- add -ObjC and -all_load to Other Linker Flags in your target's build settings
LBorderView *borderView = [[LBorderView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)]; borderView.cornerRadius = 20; borderView.borderType = BorderTypeDashed; borderView.borderWidth = 2; borderView.backgroundColor = [UIColor lightGrayColor]; borderView.borderColor = [UIColor redColor]; borderView.dashPattern = 6; borderView.spacePattern = 6; [self.view addSubview:borderView];
Check LBorderViewSample for more examples.