Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Set frame on the content view, rather than layer, for autolayout.
Browse files Browse the repository at this point in the history
Autolayout requires using the UIView geometry methods for changes
to be correctly propagated. Use that for the shimmering content view.
  • Loading branch information
grp committed Oct 30, 2016
1 parent 1130a2d commit 3589bd7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions FBShimmering/FBShimmeringView.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,15 @@ - (void)setContentView:(UIView *)contentView
}
}

- (void)layoutSubviews
{
// Autolayout requires these to be set on the UIView, not the CALayer.
// Do this *before* the layer has a chance to set the properties, as the
// setters would be ignored (even for autolayout) if set to the same value.
_contentView.bounds = self.bounds;
_contentView.center = self.center;

[super layoutSubviews];
}

@end

0 comments on commit 3589bd7

Please sign in to comment.