iOS: DoricLayout fix missing property
This commit is contained in:
parent
c8365973f0
commit
7749ea2ea2
@ -28,6 +28,7 @@
|
||||
|
||||
@interface DoricTextView : UILabel
|
||||
@property(nonatomic, assign) DoricGravity gravity;
|
||||
@property(nonatomic, assign) CGFloat contentHeight;
|
||||
@end
|
||||
|
||||
@implementation DoricTextView
|
||||
@ -41,17 +42,19 @@ - (void)drawTextInRect:(CGRect)rect {
|
||||
self.doricLayout.paddingRight));
|
||||
if ((self.gravity & DoricGravityTop) == DoricGravityTop) {
|
||||
rect.origin.y = self.doricLayout.paddingTop;
|
||||
rect.size.height = self.doricLayout.contentHeight;
|
||||
rect.size.height = self.contentHeight;
|
||||
} else if ((self.gravity & DoricGravityBottom) == DoricGravityBottom) {
|
||||
rect.origin.y = self.height - self.doricLayout.contentHeight - self.doricLayout.paddingBottom;
|
||||
rect.size.height = self.doricLayout.contentHeight;
|
||||
rect.origin.y = self.height - self.contentHeight - self.doricLayout.paddingBottom;
|
||||
rect.size.height = self.contentHeight;
|
||||
}
|
||||
rect.size.width = MAX(0.01f, rect.size.width);
|
||||
[super drawTextInRect:rect];
|
||||
}
|
||||
|
||||
- (CGSize)sizeThatFits:(CGSize)size {
|
||||
return [super sizeThatFits:size];
|
||||
CGSize result = [super sizeThatFits:size];
|
||||
self.contentHeight = result.height;
|
||||
return result;
|
||||
}
|
||||
@end
|
||||
|
||||
|
Reference in New Issue
Block a user