A very simple Objective-C UIView
category for specifying single-sided borders.
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like PREBorderView
in your projects.
pod 'PREBorderView', "~> 3.3"
Otherwise just include UIView+PREBorderView.{h,m}
in your project.
[view addBorderWithColor:UIColor.blackColor andWidth:2 atPosition:PREBorderPositionRight];
[view removeBorderAtPosition:PREBorderPositionRight];
For convenience of usage you are able to specify a defaultBorderColor
.
addBorderWithWidth:atPosition:
addRetinaPixelBorderAtPosition:
adds the border using defaultBorderColor
To easily update all borders to size changes of views
- Use
layoutBorders
to update borders of a view. - Use
layoutSubviewBorders
to update borders of a view, as well as all borders of subviews.
To update a controller's view to auto layout changes call layoutSubviewBorders
in viewDidLayoutSubviews
.
- If you found a bug, and can provide steps to reliably reproduce it, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
PREBorderView
is released under the MIT license. See LICENSE
for details.