csZBar icon indicating copy to clipboard operation
csZBar copied to clipboard

Create parameter for "Cancel" button

Open davorpeic opened this issue 9 years ago • 5 comments

It would be great if we could define "Cancel" button translation from calling the plugin from our function.

thank you Davor

davorpeic avatar May 30 '15 15:05 davorpeic

+1. When I press the back button of my phone and error callback fires

LTroya avatar Aug 28 '15 21:08 LTroya

@LTroya your issue is simply not handling cancel correctly - unrelated to @davorpeic's request:

Check if the error callback's argument is exactly "cancelled":

error('cancelled') If user cancelled the scan (with back button etc)

tjwoon avatar Aug 29 '15 15:08 tjwoon

@davorpeic agreed this would be a good addition. Filed for addition when I have time to do so.

tjwoon avatar Aug 30 '15 06:08 tjwoon

In CsZbar.m:

        UIButton *cancelButton = [[[[[[[self.scanReader.view.subviews objectAtIndex:2] subviews] objectAtIndex:0] subviews] objectAtIndex:2] subviews] objectAtIndex:0];
        [cancelButton setTitle:@"Whatever you want" forState:UIControlStateNormal];

ghost avatar Feb 03 '16 12:02 ghost

Hey all,

looks like https://github.com/tjwoon/csZBar/pull/78 has broken this fix.

I'm no good on the native side but have got things working by replacing

UIButton *cancelButton = [[[[[[[self.scanReader.view.subviews objectAtIndex:2] subviews] objectAtIndex:0] subviews] objectAtIndex:2] subviews] objectAtIndex:0];

with

UIButton *cancelButton = [[[[[[[self.scanReader.view.subviews objectAtIndex:2] subviews] objectAtIndex:0] subviews] objectAtIndex:infoButtonIndex-1] subviews] objectAtIndex:0];

Hope this helps someone

nrcrabbe avatar Feb 13 '17 01:02 nrcrabbe