How can I use removeFromSuperView and dismissModalViewControllerAnimated at same time ?
Posted
by srikanth rongali
on Stack Overflow
See other posts from Stack Overflow
or by srikanth rongali
Published on 2010-04-29T10:01:12Z
Indexed on
2010/04/29
10:47 UTC
Read the original article
Hit count: 653
I have a UIViewController *view1 and another UIViewController *view2; I used presentModelViewController to navigate from view1 to view2.
-(void)function:(id)sender
{
NSLog(@"The libraryFunction entered");
LibraryController *libraryController = [[LibraryController alloc]init];
[self presentModalViewController:libraryController animated:YES];
}
I have another view UITableViewController *tableView; I added it to view2 as a subView.
-(void)viewDidLoad
{
RootViewController *rootViewController = [[RootViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
self.navController = aNavigationController;
[aNavigationController release];
[rootViewController release];
navController.view.frame = CGRectMake(0, 0, 320, 460);
[self.view addSubview:navController.view];
}
In RootViewController.m I have
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStyleBordered target:self action:@selector(close:)];
}
-(void)close:(id)sender
{
[self.view removeFromSuperview];
[self dismissModalViewControllerAnimated:YES];
}
WhenI touch close button I need to return the view1. So, I removed the tableView by using removeFromSuperView. But, I am not able to get to the first view. I do not get where to use
- (void)dismissModalViewControllerAnimated:(BOOL)animated;
to navigate to first view1 where I have started ? How can I do this ?
Thank You.
© Stack Overflow or respective owner