0
NSString을 그릴 수는 있지만 그릴 때 크기를 조정할 수 없었습니다. 내의 drawRect : 방법은 다음과 같습니다NSString atPoint withAttributes를 그리는 방법 및 SIZE를 조정 하시겠습니까?
- (void)drawRect:(CGRect)rect
{
NSArray *objectArray = [NSArray arrayWithObjects:[UIFont systemFontOfSize:80.0f], nil];
NSArray *keyArray = [NSArray arrayWithObjects:@"NSFontAttributeName", nil];
NSMutableDictionary *textAttributes = [NSMutableDictionary dictionaryWithObjects:objectArray forKeys:keyArray];
NSString *myTestString = @"Test String";
[textAttributes setObject:[UIColor redColor] forKey:NSForegroundColorAttributeName];
[myTestString drawAtPoint:CGPointMake(20, 30) withAttributes:textAttributes];
[myTestString drawInRect:CGRectMake(50, 50, 500, 500) withAttributes:textAttributes];
NSLog(@"wrote %@ with %@", myTestString, textAttributes);
}
TextAttribute가 좋은보고, 폰트 정보로 반환됩니다
NSFontAttributeName = "<UICTFont: 0x14eeff40> font-family: \".HelveticaNeueInterface-M3\"; font-weight: normal; font-style: normal; font-size: 80.00pt"
내가 속성의 배열을 올바르게 색상을 변경할 수 있습니다, 왜 텍스트에서이 결과를 않습니다 기본 10pt 크기입니까?
NSMutableAttributedString을 사용할 수도 있습니다. –
최소한의 속성 집합 만 조정할 수 있다면 drawAtPoit : withAttributes를 사용해야하는 이유를 이해할 수 없을 것입니다. – ChrisBob