Quote:
Originally Posted by sajjad111
now my program has a tabbar view how can i show another view for 5 second and then show tabbar view(main view )?
|
I had this problem later , if you want have tab bar in project and you want to show splash at the first time with out tab bar you can manage the tab bar in delegate class and show your splash in delegate too.
Like this :
Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[self setupDetail];
}
-(void)initViewController
{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
[[UIApplication sharedApplication] setIsAccessibilityElement:YES];
[self.navigationController.navigationBar setBarStyle:UIBarStyleBlack];
UINavigationController *navTemp;
if (rootViewController==nil)
rootViewController=[[NSMutableArray alloc] init];
//init with root viewcontrolker
FirstTabBarItem *viewController1=[[FirstTabBarItem alloc] initWithTitle:@"First"];
navTemp=[[UINavigationController alloc] initWithRootViewController:viewController1];
[rootViewController addObject:navTemp];
[viewController1 release];
[navTemp release];
SecondTabBarItem *viewController2=[[SecondTabBarItem alloc] initWithTitle:@"Second"];
navTemp=[[UINavigationController alloc] initWithRootViewController:viewController2];
[rootViewController addObject:navTemp];
[viewController2 release];
[navTemp release];
ThirdTabBarItem *viewController3=[[ThirdTabBarItem alloc] initWithTitle:@"Third"];
navTemp=[[UINavigationController alloc] initWithRootViewController:viewController3];
[rootViewController addObject:navTemp];
[viewController3 release];
[navTemp release];
FourthTabBarItem *viewController4=[[FourthTabBarItem alloc] initWithTitle:@"Fourth"];
navTemp=[[UINavigationController alloc] initWithRootViewController:viewController4];
[rootViewController addObject:navTemp];
[viewController4 release];
[navTemp release];
FifthTabBarItem *viewController5=[[FifthTabBarItem alloc] initWithTitle:@"Fifth"];
navTemp=[[UINavigationController alloc] initWithRootViewController:viewController5];
[rootViewController addObject:navTemp];
[viewController5 release];
[navTemp release];
tabBar = [[UITabBarController alloc] init];
tabBar.customizableViewControllers=rootViewController;
tabBar.viewControllers = rootViewController;
tabBar.customizableViewControllers = rootViewController;
tabBar.delegate = self;
tabBar.toolbarItems =rootViewController;
tabBar.delegate=self;
[self.navigationController.navigationBar setBarStyle:UIBarStyleBlack];
return;
}
-(void)setupDetail{
UIApplication* myapp = [UIApplication sharedApplication];
myapp.idleTimerDisabled = YES;
[self initViewController];
}
-(void)changeView{
[window addSubview:tabBar.view];
[pic removeFromSuperview];
[pic release];
}
-(BOOL)setup
{
pic=[[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[pic setImage:[UIImage imageNamed:@"splash.png"]];
[window addSubview:pic];
[window makeKeyAndVisible];
[NSTimer scheduledTimerWithTimeInterval:5.0f target:self selector:@selector(changeView) userInfo:nil repeats:NO];
}
}
you can use from this code , you should set your class in initViewController .
and set your image in setup , if you have any problem with this code say me.

good luck