1

我有一个label包含在一个UIView. 边界设置与 the 相同UIView,因此label应该始终与 is 一样大view

self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
[self.label setText:@"3"];
[self.label setTextColor:[[UIColor blackColor] colorWithAlphaComponent:0.2f]];
[self.label setFont:[UIFont fontWithName:@"Futura-CondensedExtraBold" size:400]];
[self.label setBackgroundColor:[UIColor clearColor]];
[self.label setTextAlignment:NSTextAlignmentCenter];

[self.label setNumberOfLines:1];
[self.label setMinimumScaleFactor:0.1];
[self.label setAdjustsFontSizeToFitWidth:YES];

[self addSubview:self.label];

如您所见,我将 400 设置font size为 400,这太大了,想用setMinimumScaleFactor. 但这对我不起作用。有什么建议么…?

4

0 回答 0