Commit 7ab453c4 authored by Gleb Pinigin's avatar Gleb Pinigin

VLCStatusLabel: adjust label size in sizeToFit instead of manipulating frame directly

parent 1e117205
......@@ -55,7 +55,6 @@
[self sizeToFit];
CGRect selfFrame = self.frame;
CGRect parentFrame = [self superview].bounds;
selfFrame.size.width += 15.; // take extra width into account for our custom drawing
selfFrame.origin.x = (parentFrame.size.width - selfFrame.size.width) / 2.;
[self setFrame:selfFrame];
......@@ -100,6 +99,15 @@
[UIView animateWithDuration:duration animations:animationBlock completion:completionBlock];
}
#pragma mark - sizing
- (CGSize)sizeThatFits:(CGSize)size
{
CGSize textSize = [self.text sizeWithFont:self.font];
textSize.width += 16.f; // take extra width into account for our custom drawing
return textSize;
}
#pragma mark -
- (void)drawRect:(CGRect)rect
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment