Fixed Rejection

I am using a Storyboard with iOS6. I am trying to revert to the previous view manager, but it does not work.

I set up my stand 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 click segue from the previous view controller.

 if([segue.identifier isEqualToString:@"segueFbShare"]){ FbShareViewController *fbVC=[segue destinationViewController]; fbVC.imageUrl=self.product.ImageUrl; } 
+8
ios ios6
source share
2 answers

Going back to the previous UIViewController when using the UINavigationController:

 [self.navigationController popViewControllerAnimated:YES]; 

Put this line of code in your Click_On_Btn_Back method

+19
source share

When using the navigation and push controller, you need to delete the view using:

 - (void)Click_On_Btn_Back { [self.navigationController popViewControllerAnimated:YES]; } 

Also, Click_On_Btn_Back not a general iOS naming convention. You should use something more similar: clickOnBtnBack ( CamelCase ).

+4
source share

All Articles