iOS: protect setFrame incase crash
This commit is contained in:
parent
6e3307d400
commit
7f6710a7b5
@ -262,12 +262,19 @@ - (void)setFrame {
|
||||
}
|
||||
BOOL isFrameChange = ![self rect:originFrame equalTo:self.view.frame];
|
||||
if (isFrameChange) {
|
||||
if (isnan(originFrame.origin.x) || isinf(originFrame.origin.x)
|
||||
|| isnan(originFrame.origin.y) || isinf(originFrame.origin.y)
|
||||
|| isnan(originFrame.size.width) || isinf(originFrame.size.width)
|
||||
|| isnan(originFrame.size.height) || isinf(originFrame.size.height)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
self.view.frame = originFrame;
|
||||
}
|
||||
if (!UIEdgeInsetsEqualToEdgeInsets(self.corners, UIEdgeInsetsZero)) {
|
||||
if (self.view.layer.mask) {
|
||||
if ([self.view.layer.mask isKindOfClass:[DoricShapeLayer class]]) {
|
||||
DoricShapeLayer *shapeLayer = (DoricShapeLayer *)self.view.layer.mask;
|
||||
DoricShapeLayer *shapeLayer = (DoricShapeLayer *) self.view.layer.mask;
|
||||
if (!UIEdgeInsetsEqualToEdgeInsets(self.corners, shapeLayer.corners)
|
||||
|| !CGRectEqualToRect(self.view.bounds, shapeLayer.viewBounds)) {
|
||||
shapeLayer.corners = self.corners;
|
||||
|
Reference in New Issue
Block a user