tranvutuan
tranvutuan

Reputation: 6109

back button does not work,customization of the camera overlay

After adding a top navigation bar for customization of the camera overlay at here. Now I am trying to go back to the previous screen by adding an action to the back button. What I am doing is

-(IBAction)backButton:(id)sender {

NSLog(@"back button is clicked");

[self dismissModalViewControllerAnimated:YES]; 

}

However, the transition is no executed even though the console shows

back button is clicked

I also try

[self popToRootViewControllerAnimated:YES]

However,it does not work either Have you encountered this issue before, please advice me about it. Thanks

PS : I dont wanna use the cancel button built-in controls (when showsZBarControls=YES )

Upvotes: 0

Views: 258

Answers (3)

Pochi
Pochi

Reputation: 13459

i assume you are using zbarreader or something like that, you have to make that instance dismiss the thing, read the documentation for it, they clearly say that the zbar picker should be the one dismissing itself, so get the zbarimagepicker instance to dismiss it.

Upvotes: 1

Mat
Mat

Reputation: 7633

You can declare your ZBarViewController as class var, then you can call:

[self.yourZbarReder dismissModalViewControllerAnimated:YES];

Upvotes: 1

Dmorneault
Dmorneault

Reputation: 199

I assume the controller you are sending this message to is a modal view controller. You have to send

dismissModalViewControllerAnimated:

to the actual modal view controller. So it will look like this

[self.someModalViewController dismissModalViewControllerAnimated:YES];

Or you could add this code to your modal view controller

-(IBAction)backButton:(id)sender {

  NSLog(@"back button is clicked");

 [self dismissModalViewControllerAnimated:YES]; 
}

This code implies that you have knowledge of your modal view controller in the previous view. You might look into adding these view controllers into a UINavigationController so all this would be taken care of.

Upvotes: 1

Related Questions