UIView가 포함 된 UIViewController가 있습니다. viewcontroller가 표시 될 때마다 UIView를 지워야하고 콘텐츠가 다시로드되어야합니다. 문제는 이전 콘텐츠가 여전히 UIView에 나타납니다. 컨트롤러가 표시되기 전에UIViewController로 UIView 제거 및 다시 삽입
데이터로드 :
- (void)viewWillAppear:(BOOL)animated
{
contentView = [[ContentView alloc] initWithFrame:CGRectMake(10, 10, 100, 100)];
contentView.userInteractionEnabled = NO;
[self.view addSubview:contentView];
if([self loadContentData] == NO) {
[contentView release];
return NO;
}
return YES;
}
제거 내용이 컨트롤러 후 숨겨진 :
- (void)viewDidDisappear:(BOOL)animated
{
[contentView removeFromSuperview];
[contentView release];
}
이유는 충분이 정리하지?
당신이 viewWillAppear'에서 값을 반환하는 이유 : '. 무효 선별 자입니다. –