[iPhone] 각종 뷰/컨트롤을 붙일때 배경 투명하게 하기

배경색을 따로 지정하지 않았음에도 자동으로 흰색의 배경색이 들어가게 됩니다.

이것을 제거하기 위해서는 알파값을 조정할수도 있겠지만 배경색을 clearColor로 지정하면 됩니다.

[code]- (void)applicationDidFinishLaunching:(UIApplication *)application {   

    UILabel *notClearedbackground = [[UILabel alloc] initWithFrame:CGRectMake(20.0f, 100.0f, 280.0f, 50.0f)];
    [notClearedbackground setText:@”I have a background color”];
    [window addSubview:notClearedbackground];
    [notClearedbackground release];
   
    UILabel *clearedbackground = [[UILabel alloc] initWithFrame:CGRectMake(20.0f, 200.0f, 280.0f, 50.0f)];
    [clearedbackground setText:@”I’m transparent background”];
    [clearedbackground setBackgroundColor:[UIColor clearColor]];
    [window addSubview:clearedbackground];
    [clearedbackground release];
   
    [window setBackgroundColor:[UIColor grayColor]];
    [window makeKeyAndVisible];
}[/code]
사용자 삽입 이미지위에것이 적용하기 전, 아래것이 적용한 후입니다.

1231788046.zip