[英]How to remove insets in UILabel in iOS
您可能想尝试子类化UILabel
并覆盖drawTextInRect:
with:
- (void)drawTextInRect:(CGRect)rect
{
[super drawTextInRect:UIEdgeInsetsInsetRect(rect, UIEdgeInsetsMake(0., 0., 0., 0.))];
}
CGRect frame = CGRectMake(0, 0, 120, 30);
UIEdgeInsets contentInsets = UIEdgeInsetsMake(0, 0, 0, 0);
CGRect labelFrame = UIEdgeInsetsInsetRect(frame, contentInsets);
UILabel *label = [[UILabel alloc] initWithFrame:labelFrame];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.