Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YYTextBorder显示不完整 #308

Closed
baecheung opened this issue May 6, 2016 · 4 comments
Closed

YYTextBorder显示不完整 #308

baecheung opened this issue May 6, 2016 · 4 comments

Comments

@baecheung
Copy link

baecheung commented May 6, 2016

Text Attributes 1入口,仅显示Border时

    NSMutableAttributedString *one = [[NSMutableAttributedString alloc] initWithString:@"Border"];
    one.yy_font = [UIFont boldSystemFontOfSize:30];
    one.yy_color = [UIColor colorWithRed:1.000 green:0.029 blue:0.651 alpha:1.000];

    YYTextBorder *border = [YYTextBorder borderWithLineStyle:YYTextLineStyleSingle lineWidth:1 strokeColor:[UIColor colorWithRed:1.000 green:0.029 blue:0.651 alpha:1.000]];
    border.cornerRadius = 3;
    border.insets = UIEdgeInsetsMake(-4, -4, -4, -4);
    one.yy_textBackgroundBorder = border;

    YYLabel *label = [YYLabel new];
    label.attributedText = one;
    label.width = self.view.width;
    label.height = self.view.height - (kiOS7Later ? 64 : 44);
    label.top = (kiOS7Later ? 64 : 0);
    label.textAlignment = NSTextAlignmentCenter;
    label.textVerticalAlignment = YYTextVerticalAlignmentCenter;
    label.numberOfLines = 0;
    label.backgroundColor = [UIColor colorWithWhite:0.933 alpha:1.000];
    [self.view addSubview:label];

1

@ibireme
Copy link
Owner

ibireme commented May 6, 2016

border 超过了视图边界,所以被裁剪掉了。这需要把 Label 视图调高一些,为 border 提供足够的空间。

@baecheung
Copy link
Author

@ibireme Label已经是全屏幕了,应该怎么调呢?这个就是你Demon中的例子

@ibireme
Copy link
Owner

ibireme commented May 6, 2016

label.textContainerInset = UIEdgeInsetsMake(5, 5, 5, 5);

@baecheung
Copy link
Author

@ibireme 非常感谢!

@ibireme ibireme closed this as completed May 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants