зеркало из https://github.com/github/Rebel.git
Add RBLView.cornerRadius
This way, it can be saved and reapplied just like other layer properties.
This commit is contained in:
Родитель
e0cbb42ea4
Коммит
c48bb20e9d
|
@ -22,6 +22,15 @@
|
|||
// Defaults to NO.
|
||||
@property (nonatomic, assign) BOOL clipsToBounds;
|
||||
|
||||
// A radius used to draw rounded corners for the view's background. This property
|
||||
// is not the same as CALayer.cornerRadius, but does manipulate it.
|
||||
//
|
||||
// Typically, you will want to enable clipsToBounds when setting this property
|
||||
// to a non-zero value.
|
||||
//
|
||||
// Defaults to 0.
|
||||
@property (nonatomic, assign) CGFloat cornerRadius;
|
||||
|
||||
// Whether the view's drawing completely fills its bounds with opaque content.
|
||||
//
|
||||
// Defaults to NO.
|
||||
|
|
|
@ -42,6 +42,11 @@ static IMP RBLViewDrawRectIMP;
|
|||
[self applyLayerProperties];
|
||||
}
|
||||
|
||||
- (void)setCornerRadius:(CGFloat)radius {
|
||||
_cornerRadius = radius;
|
||||
[self applyLayerProperties];
|
||||
}
|
||||
|
||||
- (BOOL)clipsToBounds {
|
||||
return _flags.clipsToBounds;
|
||||
}
|
||||
|
@ -170,6 +175,7 @@ static IMP RBLViewDrawRectIMP;
|
|||
|
||||
- (void)applyLayerProperties {
|
||||
self.layer.backgroundColor = self.backgroundColor.rbl_CGColor;
|
||||
self.layer.cornerRadius = self.cornerRadius;
|
||||
self.layer.masksToBounds = self.clipsToBounds;
|
||||
self.layer.opaque = self.opaque;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче