2012-03-16 91 views
0

我建設基於視圖的應用程序,其中有許多頁面在每個頁面中將是home按鈕,它將調用主頁,但我的問題是每當我打電話回家的主頁視圖將重新加載,但我不需要重新加載,所以請給我建議....基於iphone視圖的應用程序無需重新加載視圖

HomePage.m

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    twitAll=0; 
    facAll=0; 
    CrtPage=0; 
    flag=[[NSString alloc]init]; 
    [self Maintainpages]; 
    [tbv setFrame:CGRectMake(0*self.scrollView.frame.size.width,0,self.scrollView.frame.size.width,self.scrollView.frame.size.height-90)]; 
    [tbv1 setFrame:CGRectMake(1*self.scrollView.frame.size.width,0,self.scrollView.frame.size.width,self.scrollView.frame.size.height-90)]; 
    [tbv2 setFrame:CGRectMake(2*self.scrollView.frame.size.width,0,self.scrollView.frame.size.width,self.scrollView.frame.size.height-90)]; 
    [tbv3 setFrame:CGRectMake(3*self.scrollView.frame.size.width,0,self.scrollView.frame.size.width,self.scrollView.frame.size.height-90)]; 
    tbv1.hidden=YES; 
    tbv2.hidden=YES; 
    tbv3.hidden=YES; 
    tbv.hidden=YES; 
    self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"Background-bluegray.png"]]; 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(LoginCompletedSuccess:) name:@"IntigrateCompleted" object:nil]; 
    topbar.backgroundColor=[[[UIColor alloc]initWithPatternImage:[UIImage imageNamed:@"top-bar.png"]]autorelease]; 
    bottombar.backgroundColor=[[[UIColor alloc]initWithPatternImage:[UIImage imageNamed:@"top-bar.png"]]autorelease]; 
} 

回答

1

對於未重裝的觀點就必須加入所有NewView的與此源代碼父視圖的子視圖。

[parentView addSubview:childView]; 

,並把此子視圖前

[parentView bringSubviewToFront:childView]; 

點擊home鍵刪除所有子視圖的,它會應該你parentView

for(UIView *subview in [parentView subviews]) { 
    [subview removeFromSuperview]; 
} 
相關問題