Bordered view with support for inset borders. BNBorderedView allows for the creation of custom size and color borders and insets on your UIView. Much in the same way you would be able to define borders on an div
with CSS. With BNBorderedView you can define each border to have differing properties.
This was a class I used in a project a long time ago that I wanted to open source rather than sit around.
Copy BNBorderedView.h
and BNBorderedView.m
to your projects.
pod 'BNBorderedView', :git => 'https://github.com/brentnycum/BNBorderedView.git'
Using BNBorderedView is simple. Simply initialize like any normal UIView
.
BNBorderedView *borderedView = [[BNBorderedView alloc] initWithFrame:CGRect(10, 10, 60, 60)];
In BNBorderedView you can set everything via properties.
borderedView.topBorderColor = [UIColor blueColor];
-
topBorderColor
-
bottomBorderColor
-
leftBorderColor
-
rightBorderColor
-
setBorderColor:(UIColor *)color
To set all border colors.
-
topBorderSize
-
bottomBorderSize
-
leftBorderSize
-
rightBorderSize
-
setBorderSize:(CGSize)size
To set all border sizes.
-
topInsetColor
-
bottomInsetColor
-
leftInsetColor
-
rightInsetColor
-
setInsetColor:(UIColor *)color
To set all inset colors.
-
topInsetSize
-
bottomInsetSize
-
leftInsetSize
-
rightInsetSize
-
setInsetSize:(CGSize)size
To set all inset sizes.