iOS: DoricLayout fix missing property
This commit is contained in:
parent
c8365973f0
commit
7749ea2ea2
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
@interface DoricTextView : UILabel
|
@interface DoricTextView : UILabel
|
||||||
@property(nonatomic, assign) DoricGravity gravity;
|
@property(nonatomic, assign) DoricGravity gravity;
|
||||||
|
@property(nonatomic, assign) CGFloat contentHeight;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation DoricTextView
|
@implementation DoricTextView
|
||||||
@ -41,17 +42,19 @@ - (void)drawTextInRect:(CGRect)rect {
|
|||||||
self.doricLayout.paddingRight));
|
self.doricLayout.paddingRight));
|
||||||
if ((self.gravity & DoricGravityTop) == DoricGravityTop) {
|
if ((self.gravity & DoricGravityTop) == DoricGravityTop) {
|
||||||
rect.origin.y = self.doricLayout.paddingTop;
|
rect.origin.y = self.doricLayout.paddingTop;
|
||||||
rect.size.height = self.doricLayout.contentHeight;
|
rect.size.height = self.contentHeight;
|
||||||
} else if ((self.gravity & DoricGravityBottom) == DoricGravityBottom) {
|
} else if ((self.gravity & DoricGravityBottom) == DoricGravityBottom) {
|
||||||
rect.origin.y = self.height - self.doricLayout.contentHeight - self.doricLayout.paddingBottom;
|
rect.origin.y = self.height - self.contentHeight - self.doricLayout.paddingBottom;
|
||||||
rect.size.height = self.doricLayout.contentHeight;
|
rect.size.height = self.contentHeight;
|
||||||
}
|
}
|
||||||
rect.size.width = MAX(0.01f, rect.size.width);
|
rect.size.width = MAX(0.01f, rect.size.width);
|
||||||
[super drawTextInRect:rect];
|
[super drawTextInRect:rect];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGSize)sizeThatFits:(CGSize)size {
|
- (CGSize)sizeThatFits:(CGSize)size {
|
||||||
return [super sizeThatFits:size];
|
CGSize result = [super sizeThatFits:size];
|
||||||
|
self.contentHeight = result.height;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -323,8 +326,8 @@ - (void)requestLayout {
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIFont *)registerFontWithFontData:(NSData *)fontData fontSize:(CGFloat)fontSize{
|
- (UIFont *)registerFontWithFontData:(NSData *)fontData fontSize:(CGFloat)fontSize {
|
||||||
CGDataProviderRef fontDataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef)fontData);
|
CGDataProviderRef fontDataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef) fontData);
|
||||||
// THE NEXT LINE IS RELEVANT PART
|
// THE NEXT LINE IS RELEVANT PART
|
||||||
// https://stackoverflow.com/questions/24900979/cgfontcreatewithdataprovider-hangs-in-airplane-mode
|
// https://stackoverflow.com/questions/24900979/cgfontcreatewithdataprovider-hangs-in-airplane-mode
|
||||||
[UIFont familyNames];
|
[UIFont familyNames];
|
||||||
|
Reference in New Issue
Block a user