presentModalViewController does not call any methods - iphone

In presentModalViewController does not call any methods after login the Facebook using SSO.
SignInViewController *signView=[[SignInViewController alloc]init];
signView.delegate=self;
[self.navigationController presentModalViewController:signView animated:YES];
[signView release];
- (void)cancelAction
{
[self dismissModalViewControllerAnimated:YES];
}
The cancelAction method is calling but not dismissed..
Please help me.

SignInViewController *signView=[[SignInViewController alloc]init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:signView];
[signView release];
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
-(void)cancelAction
{
[self dismissModalViewControllerAnimated:YES];
}
try implementing this...
hope this will work for you..

Related

presentViewController:imagePickerController is popping my navigationController?

I am using presentViewController:imagePickerController to display the UIImagePickerController. For some reason when I end up dismissing that controller my original navigation controller looses it's stack and my application is back at the root view controller.
I am logging self.navigationController.viewControllers and I can see that after I run the presentViewController:imagePickerController line my navigation controller looses all of its controllers except for the root controller.
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = sourceType;
imagePickerController.delegate = self;
imagePickerController.navigationBarHidden = YES;
self.imagePickerController = imagePickerController;
DLog(#"self.navigationController:%#",self.navigationController.viewControllers);
[self.navigationController presentViewController:imagePickerController animated:YES completion:^{
DLog(#" after presenting self.navigationController:%#",self.navigationController.viewControllers);
}];
////Closing it
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
DLog(#"self.navigationController:%#",self.navigationController.viewControllers);
[self.navigationController dismissViewControllerAnimated:YES completion:^{
}];
}
/////Where my NC is set up
OFMainViewController *mainController = [[OFMainViewController alloc]init];
mainController.managedObjectContext = self.managedObjectContext;
navigationController = [[UINavigationController alloc]initWithRootViewController:mainController];
[self.window setRootViewController:navigationController];
Instead of using self.navigationController use self for both dismissing and calling the imagepickerviewcontroller.
You should present imagePickeController on self instead of self.navigationController.
[self presentViewController:imagePickerController animated:YES completion:^{
DLog(#" after presenting self:%#",self.navigationController.viewControllers);
}];
And dissmiss it accordingly:
////Closing it
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
DLog(#"self.navigationController:%#",self.navigationController.viewControllers);
[self dismissViewControllerAnimated:YES completion:^{
}];
}

Show another ViewController

help me please. How can I show another view controller after dismissing the existing one? here is my code:
- (void)matchmakerViewControllerWasCancelled:
(GKMatchmakerViewController *)viewController{
[self dismissModalViewControllerAnimated:YES];
ViewController *Vc = [[ViewController alloc]init];
[self presentModalViewController:Vc animated:YES];
}
My code doesn't work. Help me please. If i wrote NSLog after dismissingModalViewController, it shows me that NSLog, but ViewController won't show. thanks
[self dismissModalViewControllerAnimated:YES]; has been deprecated. Try doing:
- (void)matchmakerViewControllerWasCancelled:
(GKMatchmakerViewController *)viewController{
[self dismissViewControllerAnimated:YES completion:^{
ViewController *Vc = [[ViewController alloc]init];
[self presentViewController:Vc animated:YES completion:^{}];
}];
}
Simply check this
[self dismissModalViewControllerAnimated:NO];
Nextview *sec = [[Nextview alloc] initWithNibName:#"Nextview" bundle:nil];
[self presentModalViewController:sec animated:YES];
[sec release];
Hope this works.

presentModalViewController not responding from NSObject class

I have to need to call a presentModalViewController from NSObject class.
ViewController *controller = [[ViewController alloc] initWithNibName:#"ViewController" bundle:nil];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[[appDelegate navigationController] presentModalViewController:controller animated:YES];
[controller release];
Above code is working fine for iPhone but not responding for iPad View.
may be your appdeligate or the navigation controller are getting nil,
check your appdelegate declaration once or use the line
[[[[UIApplication sharedApplication] delegate] navigationController] presentModalViewController:imagePicker animated:YES];

Why is presentModalViewController not working?

I am presenting a modalcontroller in a view, after i dissmiss the view i want to present another modalView but the code is not working, i have a delegate method that is being called when i press a button on the first modal vieview in witch i have the code.
inside the parentView the method for the firstview delegat:
-(void)newMessageModalView:(NewMessageModalView *)controller didFinishSelecting:(int)selectedChannel{
[self dismissModalViewControllerAnimated:YES];
SecondView * detailView = [[SecondView alloc] initWithNibName:#"SecondView" bundle:nil];
[self presentModalViewController:SecondView animated:YES];
[detailView release];
[self dismissModalViewControllerAnimated:YES];
}
You are presenting SecondView, which is your class and not your instance. Even if that was right, you are dismissing it straight away.
Move [self dismissModalViewControllerAnimated:YES]; to detailView.m
-(void)newMessageModalView:(NewMessageModalView *)controller didFinishSelecting:(int)selectedChannel{
SecondView * detailView = [[SecondView alloc] initWithNibName:#"SecondView" bundle:nil];
[self presentModalViewController:SecondView animated:YES];
[detailView release];
}
For example, in detailView.m
- (void)cancelBtnTouched:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}

Why is my popToRootViewControllerAnimated not getting called?

I have even tried implementing a delay right before the call to popToRootViewControllerAnimated however that does no good either. It just does not get called.
-(IBAction) btnSignOut{
[[self tabBarController]setSelectedIndex:0];
[[self navigationController]popToRootViewControllerAnimated:NO];//DOES NOT GET CALLED
Overview *overviewController = [[Overview alloc] initWithNibName:#"Overview" bundle:nil];
//Lets place OverView in navController
UINavigationController * navController = [[UINavigationController alloc] initWithRootViewController:overviewController];
// [[self navigationController] popToViewController:ComposeViewController animated:YES];
//Now lets display it
[self.tabBarController presentModalViewController:navController animated:YES];
[navController release];
[overviewController release];
}
It seems like the [self navigationController] does not contain any view to pop