私は、tabviewcontroller.viewにサブビューとしてUiimageviewを追加しています。私が他のビューコントローラにプッシュするとtabbarcontrollerは隠されますが、画像は他のクラスにプッシュして表示されています。tabbarcontrollerのすべてのタブバーアイテムはナビゲーションコントローラです。私はここでtabbarcontroller 内タブバーを追加didntは私のコードです:他のView Controllerにプッシュされたときにuiimageを非表示にする
imgV=[[UIImageView alloc]initWithFrame:CGRectMake(0, 428, 320, 48)];
tabBarController = [[UITabBarController alloc] init];
tabBarController.moreNavigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
tabBarController.moreNavigationController.topViewController.view.backgroundColor=[UIColor clearColor];
tabBarController.delegate=self;
// tabBarController.selectedIndex = 0;
UIImage *img = [UIImage imageNamed: @"home_selected.png"];
[imgV setImage:img];
// [imgV setAlpha:0.5];
[self.tabBarController.view addSubview:imgV];
[self.tabBarController.view bringSubviewToFront:imgV];
[imgV release];
Dashboard_iPhone *dash = [[Dashboard_iPhone alloc] init];
UINavigationController *tabItem0 = [[[UINavigationController alloc] initWithRootViewController:dash] autorelease];
tabItem0.view.backgroundColor=[UIColor clearColor];
TrackProgram_iPhone *rep = [[TrackProgram_iPhone alloc] init];
UINavigationController *tabItem1 = [[[UINavigationController alloc] initWithRootViewController:rep] autorelease];
[email protected]"TrackProgram";
tabItem1.view.backgroundColor=[UIColor clearColor];
TrackClinic_iPhone *loc = [[TrackClinic_iPhone alloc] init];
UINavigationController *tabItem2 = [[[UINavigationController alloc] initWithRootViewController:loc] autorelease];
[email protected]"TrackClinic ";
tabItem2.view.backgroundColor=[UIColor clearColor];
tabBarController.viewControllers=[NSArray arrayWithObjects:tabItem0,tabItem1,tabItem2,nil];
[self.view insertSubview:tabBarController.view belowSubview:dash.view ];
[self presentModalViewController:tabBarController animated:NO];
私は他のクラスに
-(void)logoutBtnTap
{
appDelegate.enterLogout=YES;
for(UIImageView *view in[self.view subviews])
{
for(UIImage *img in view.subviews){//remove photoes from the subview
[img removeFromSuperview];
}
[view removeFromSuperview];
}
Login_iPhone *controller=[[Login_iPhone alloc]init];
[controller setHidesBottomBarWhenPushed:YES];
[acctExec_iPhone.imgV removeFromSuperview];
acctExec_iPhone.imgV.hidden=YES;
[self.navigationController pushViewController:controller animated:YES];
[controller release];
}
[Hiding Imageview](http://stackoverflow.com/questions/9989224/hiding-imageview)のダブル投稿 – jrturton