dismissViewControllerAnimated not working

I am using Storyboard with IOS6. I am trying to go back to the previous viewcontroller but it is not working.

I customized my backbutton here.

UIButton *btnBack = [UIButton buttonWithType:UIButtonTypeCustom];
btnBack.frame = CGRectMake(0, 0, 45,35);
[btnBack setTitle:@"Back" forState:UIControlStateNormal];
[btnBack.titleLabel setFont: [UIFont fontWithName:@"Courier" size:15]];
btnBack.layer.cornerRadius=5.0;
btnBack.layer.borderWidth=2.0;
[btnBack setBackgroundColor:[UIColor colorFbBlue]];
btnBack.layer.borderColor=[UIColor colorFbBlue].CGColor;
[btnBack setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[btnBack addTarget:self action:@selector(Click_On_Btn_Back) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backBarButton = [[UIBarButtonItem alloc] initWithCustomView:btnBack];

-(void)Click_On_Btn_Back{
[self dismissViewControllerAnimated:YES completion:nil];

 }

This is how i push segue from previous view controller.

if([segue.identifier isEqualToString:@"segueFbShare"]){
    FbShareViewController *fbVC=[segue destinationViewController];
    fbVC.imageUrl=self.product.ImageUrl;

}

Answers


Going to previous UIViewController when using a UINavigationController:

[self.navigationController popViewControllerAnimated:YES];

Put that line of code in your Click_On_Btn_Back method


Need Your Help

java bytecode class definition

java compiler-construction jvm bytecode

currently I am working on a project that deals with byte-code analysis. I came across the code,

BouncyCastle PEMParser throws NoClassDefFound and VerifyError using GenyMotion Emulator

android noclassdeffounderror bouncycastle genymotion verifyerror

Due to Samsung devices being utterly terrible, I have switched to use GenyMotion as an Android emulator. However, code that worked on the Samsung Note I own crashes on the emulator with a

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.