parent
6164f65f0a
commit
0983448c74
|
@ -44,6 +44,17 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value);
|
|||
- (void)setCompressionResistanceVerticalLow;
|
||||
- (void)setCompressionResistanceVerticalHigh;
|
||||
|
||||
#pragma mark - Manual Layout
|
||||
|
||||
- (CGFloat)left;
|
||||
- (CGFloat)right;
|
||||
- (CGFloat)top;
|
||||
- (CGFloat)bottom;
|
||||
- (CGFloat)width;
|
||||
- (CGFloat)height;
|
||||
|
||||
- (void)centerOnSuperview;
|
||||
|
||||
#pragma mark - Debugging
|
||||
|
||||
- (void)addBorderWithColor:(UIColor *)color;
|
||||
|
|
|
@ -131,6 +131,47 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
|
|||
[self setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
|
||||
}
|
||||
|
||||
#pragma mark - Manual Layout
|
||||
|
||||
- (CGFloat)left
|
||||
{
|
||||
return self.frame.origin.x;
|
||||
}
|
||||
|
||||
- (CGFloat)right
|
||||
{
|
||||
return self.frame.origin.x + self.frame.size.width;
|
||||
}
|
||||
|
||||
- (CGFloat)top
|
||||
{
|
||||
return self.frame.origin.y;
|
||||
}
|
||||
|
||||
- (CGFloat)bottom
|
||||
{
|
||||
return self.frame.origin.x + self.frame.size.height;
|
||||
}
|
||||
|
||||
- (CGFloat)width
|
||||
{
|
||||
return self.frame.size.width;
|
||||
}
|
||||
|
||||
- (CGFloat)height
|
||||
{
|
||||
return self.frame.size.height;
|
||||
}
|
||||
|
||||
- (void)centerOnSuperview
|
||||
{
|
||||
self.frame = CGRectMake(
|
||||
round(self.superview.bounds.origin.x + (self.superview.bounds.size.width - self.frame.size.width) * 0.5f),
|
||||
round(self.superview.bounds.origin.y + (self.superview.bounds.size.height - self.frame.size.height) * 0.5f),
|
||||
self.frame.size.width,
|
||||
self.frame.size.height);
|
||||
}
|
||||
|
||||
#pragma mark - Debugging
|
||||
|
||||
- (void)addBorderWithColor:(UIColor *)color
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#import "OWSBezierPathView.h"
|
||||
#import "UIColor+OWS.h"
|
||||
#import "UIFont+OWS.h"
|
||||
#import "UIView+OWS.h"
|
||||
#import <JSQMessagesViewController/UIView+JSQMessages.h>
|
||||
|
||||
@interface OWSUnreadIndicatorCell ()
|
||||
|
@ -62,16 +63,10 @@
|
|||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
CGSize labelSize = [self.label sizeThatFits:CGSizeZero];
|
||||
self.label.frame = CGRectMake(round(self.bounds.origin.x + (self.bounds.size.width - labelSize.width) * 0.5f),
|
||||
round(self.bounds.origin.y + (self.bounds.size.height - labelSize.height) * 0.5f),
|
||||
labelSize.width,
|
||||
labelSize.height);
|
||||
self.leftPathView.frame = CGRectMake(0, 0, self.label.frame.origin.x, self.bounds.size.height);
|
||||
self.rightPathView.frame = CGRectMake(self.label.frame.origin.x + self.label.frame.size.width,
|
||||
0,
|
||||
self.bounds.size.width - (self.label.frame.origin.x + self.label.frame.size.width),
|
||||
self.bounds.size.height);
|
||||
[self.label sizeToFit];
|
||||
[self.label centerOnSuperview];
|
||||
self.leftPathView.frame = CGRectMake(0, 0, self.label.left, self.height);
|
||||
self.rightPathView.frame = CGRectMake(self.label.right, 0, self.width - self.label.right, self.height);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue