6
레이어 내 텍스트의 글꼴 속성을 수정하려고하지만 발생하지 않습니다. 누구든지 도와 줄 수 있습니까? 코드를 검색 :CATextLayer에서 글꼴 크기 및 유형이 적용되지 않습니다.
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
// All HypnosisViews start with a clear background color
[self setBackgroundColor:[UIColor clearColor]];
[self setCircleColor:[UIColor lightGrayColor]];
// Create the new layer object
boxLayer = [[CATextLayer alloc] init];
// Give it a size
[boxLayer setBounds:CGRectMake(0.0, 0.0, 300.0, 85.0)];
// Give it a location
[boxLayer setPosition:CGPointMake(160.0, 350.0)];
// Make half-transparent red the background color for the layer
UIColor *reddish = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.75];
// Get CGColor object with the same color values
CGColorRef cgReddish = [reddish CGColor];
[boxLayer setBackgroundColor:cgReddish];
// Make it a sublayer on the view's layer
[[self layer] addSublayer:boxLayer];
NSString *text2 = @"You are me.";
UIFont *font2 = [UIFont fontWithName:@"Times New Roman" size:10.0];
[text2 sizeWithFont:font2];
[boxLayer setString:text2];
}
return self;
}
이것은 환상적입니다. 감사. 그것은 효과가 있었다. – Armand
완벽 함 - 찾고있는 것이라면 올바른 답으로 표시하여 다른 사람에게 표시되도록합니다. 해결되었습니다! –
물론 어떻게 할 것인가? 나는이 사이트에서 새로운 사람이다. CATextLayer에 대해서 : 레이어 코너를 반올림 할 방법이 있습니까? 그리고 레이어 안의 텍스트에 대해 어떻게 선을 끊으시겠습니까? – Armand