0
검은 색 배경의 CALayer를 표시하려고합니다. AppDelegate를 위임자로 파일 소유자에게 첨부했습니다. 콘솔은 "awaking from nib ..."로그 문을 올바르게보고합니다. 그러나 나는 중간에 그려진 블랙 박스가없는 빈 회색 창 (크기는 335x390)을 보았습니다. 내가 누락 된 개념은 무엇입니까? 도움에 미리윈도우 내부에 표시 할 CALayer를 갖고 싶습니다.
감사합니다,
찰스
#import "AppDelegate.h"
#import <QuartzCore/QuartzCore.h>
@implementation AppDelegate
-(void)awakeFromNib;
{
NSLog(@"awaking from nib...");
[[window contentView] setWantsLayer:YES];
layer = [CALayer layer];
[layer setBounds:CGRectMake(0.0,0.0,100.0,100.0)];
// center the animation layer
[layer setPosition:CGPointMake([[window contentView] frame].size.width/2, [[window contentView]frame].size.height/2)];
CGColorRef color = CGColorCreateGenericRGB(0., 0., 0., 1);
[layer setBackgroundColor:color];
CFRelease(color);
[layer setBorderWidth:5.0f];
[[[window contentView] layer] addSublayer:layer];
}
@end
브래드, 색상 문제에 저를 정정 감사합니다. 나는 질문에서 수정하여 나중에 다른 사람들에게 혼란스럽지 않게 할 것이다. 예, "창"속성은없는 개념이 아닙니다. 감사! – Charles