【发布时间】:2015-01-26 12:50:40
【问题描述】:
我有一个 UILabel,我可以在其中添加阴影。 UILabel 出现了,阴影也出现了,但是最左边的阴影被切断了,因此它与文本的边缘对齐。我移动了标签的位置以查看它是否被视图覆盖,但一切都保持不变。我还取出了 sizeToFit,它保持不变。下面是标签的初始化:
UILabel *scoreLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];
scoreLabel.text = text;
[scoreLabel setFont:[UIFont fontWithName:fontName size:fontSize]];
scoreLabel.textColor = [UIColor colorWithRed:red green:green blue:blue alpha:1.0];
scoreLabel.shadowColor = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f];
scoreLabel.shadowOffset = CGSizeMake(-10.0, 2.0);
scoreLabel.clipsToBounds = NO;
[scoreLabel sizeToFit];
scoreLabel.center = CGPointMake(x, y);
【问题讨论】:
-
只是出于兴趣,那是什么字体?
标签: ios objective-c uilabel shadow