How can I use removeFromSuperView and dismissModalViewControllerAnimated at same time ?
- by srikanth rongali
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.