일부 텍스트로 rect를 채워야합니다. rect의 크기는 고정되어 있습니다. iOS. adjustsFontSizeToFitWidth 메서드가 제대로 작동하지 않습니다.
- (void)drawText:(NSString *)text onView:(UIView *)view inRect:(CGRect)rect
{
UILabel *lbl = [[UILabel alloc] initWithFrame:rect];
lbl.minimumFontSize = 1;
lbl.font = [UIFont systemFontOfSize:30];
[lbl setText:text];
lbl.adjustsFontSizeToFitWidth = YES;
[view addSubview:lbl];
[lbl release];
}
그런 다음 나는이 비슷한 쓰기 :
[self drawText:@"Asdfghjkl;" onView:view inRect:CGRectMake(45, 40, 85, 13)];
[self drawText:@"qwertyui" onView:view inRect:CGRectMake(173, 31, 126, 22)];
를 그리고 난의 cutted 텍스트를 가져
나는 다음과 같은 기능을 사용할 수 있습니다. 내 실수는 어디 갔지?