удалить viewController из окна iPhone - PullRequest
0 голосов
/ 28 августа 2009

В моем приложении указан следующий код.

В комментариях в моем коде будет указано "Мой вопрос".

- (void)applicationDidFinishLaunching:(UIApplication *)application {    
tabBarObj = [[UITabBarController alloc] init];

vctr0=[[SplashScrn alloc] initWithNibName:@"SplashScrn" bundle:nil];
vctr1=[[SearchViewController alloc] initWithNibName:@"SearchViewController" bundle:nil];
vctr2=[[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];

UINavigationController *nvctr1=[[[UINavigationController alloc]initWithRootViewController:vctr1] autorelease];
UINavigationController *nvctr2=[[[UINavigationController alloc]initWithRootViewController:vctr2] autorelease];

tabBarObj.viewControllers=[NSArray arrayWithObjects:nvctr1,nvctr2,nil];
[window addSubview:vctr0.view];
[window makeKeyAndVisible];

[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(hideSplash) userInfo:nil repeats:NO];
}

-(void)hideSplash
{
/*  CATransition *tr=[CATransition animation];
tr.duration=0.75;
tr.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
tr.type=kCATransitionMoveIn;
tr.subtype=kCATransitionFromRight;
[vctr0.view.layer addAnimation:tr forKey:nil]; */
// actually here i want to remove vctr0 - viewcontroller 0 - a splash screen
// e.g [vctr0 removeFromSuperView];
// [window addSubView:tabBarObj];
// I don't know the correct code for this.
}

Заранее спасибо за помощь.

Ответы [ 2 ]

1 голос
/ 28 августа 2009

Попробуйте

[vctr0.view removeFromSuperview];
0 голосов
/ 28 августа 2009

Я сделал несколько исследований и разработок для своего кода.

Кстати, я получил решение, которое хотел.

Я реализовал следующий код и все прошло успешно.

- (void)applicationDidFinishLaunching:(UIApplication *)application {    
tabBarObj = [[UITabBarController alloc] init];

vctr0=[[SplashScrn alloc] initWithNibName:@"SplashScrn" bundle:nil];
vctr1=[[SearchViewController alloc] initWithNibName:@"SearchViewController" bundle:nil];
vctr2=[[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];

UINavigationController *nvctr1=[[[UINavigationController alloc]initWithRootViewController:vctr1] autorelease];
UINavigationController *nvctr2=[[[UINavigationController alloc]initWithRootViewController:vctr2] autorelease];

tabBarObj.viewControllers=[NSArray arrayWithObjects:nvctr1,nvctr2,nil];
[window addSubview:vctr0.view];
[window makeKeyAndVisible];

[NSTimer scheduledTimerWithTimeInterval:0.75 target:self selector:@selector(hideSplash) userInfo:nil repeats:NO];
}
-(void)hideSplash
{
CATransition *tr=[CATransition animation];
tr.duration=0.75;
tr.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
tr.type=kCATransitionMoveIn;
tr.subtype=kCATransitionFromRight;
[tabBarObj.view.layer addAnimation:tr forKey:nil];
[window addSubview:tabBarObj.view];
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...