2012-03-19 4 views
0

우리는 배경 그림을 설정할 기본 클래스를 사용하고 있습니다.viewDidLoad의 하위 클래스에 다른 배경 이미지 설정

UIImage* image = [UIImage imageNamed:@"App_Background.png"]; 
UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; 
imageView.contentMode = UIViewContentModeScaleAspectFill; 
CGRect bounds = self.view.bounds; 
int offset = 0; 

imageView.frame = CGRectMake(0, bounds.size.height - image.size.height + offset, image.size.width, image.size.height); 
imageView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin; 
imageView.tag = BACKGROUND_TAG; 
[self.view insertSubview:imageView atIndex:0]; // insert it behind all other views in NIB 

self.background = [imageView autorelease]; // cleanup 

내가 다른 UIViewController에 대한 내 슈퍼 클래스로 사용하고 싶지만를 backgound를 사용하지 않으려면, 내가 그걸 어떻게해야합니까 : 좋아하는 코드가 보인다? 내 하위 클래스 'viewDidLoad에서 이것을 할 수있을 거라 생각 :

UIView *theBackgroundView = [self.view viewWithTag:BACKGROUND_TAG ]; 
theBackgroundView = nil; 

하지만 작동하지 않습니다. 이견있는 사람? 감사.

답변

0

[super viewDidLoad]으로 전화하십시오.으로 전화하십시오. 그런 다음 [[self.view viewWithTag: BACKGROUND_TAG] removeFromSuperview]을 수행하십시오.