Interface Builder를(alpha=0) 이용하지 않고, 소스상에서 배경색을 지우는 방법입니다
[UIColor clearColor];
아래의 소스를 이용해서 직접 확인해 보세요
=======================================================================
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptons {
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];
}
=======================================================================
댓글 없음:
댓글 쓰기