0

enter image description herei'm using a QR Code SDK when pressed the button, it will have a presentModalView in there i got a info button. i wanted it to link to another nib to show the info on how it works!

-(IBAction)QRscan;
    {       
        //Make sure we can even attempt barcode recognition, (i.e. on a device without a camera, you wouldn't be able to scan anything).
        if([SKScannerViewController canRecognizeBarcodes])
        { 
            SKScannerViewController *scannerVC = [[SKScannerViewController alloc] init]; //Insantiate a new SKScannerViewController
            scannerVC.delegate = self;
            scannerVC.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelTapped)];

            UIButton *button = [UIButton buttonWithType:UIButtonTypeInfoLight];
            [button addTarget:self action:@selector(settingsTapped) forControlEvents:UIControlEventTouchUpInside];
            UIBarButtonItem *infoItem = [[UIBarButtonItem alloc] initWithCustomView:button];
            scannerVC.navigationItem.rightBarButtonItem = infoItem; 
            scannerVC.title = @"Scan a QRcode";
            qrtest.text = @""; //Reset our info text label.
            scannerVC.shouldLookForQRCodes = YES;//QRCode Checker
            UINavigationController *_nc = [[[UINavigationController alloc] initWithRootViewController:scannerVC] autorelease]; //Put our SKScannerViewController into a UINavigationController. (So it looks nice).
            [scannerVC release];
            [self presentModalViewController:_nc animated:YES]; //Slide it up onto the screen.
        }


- (void) settingsTapped {

    qrcode_info *otherVC = [[qrcode_info alloc] initWithNibName:@"qrcode_info" bundle:Nil  ];

    [self presentModalViewController: otherVC animated:YES];
    [otherVC release];
}
Desmond
  • 5,001
  • 14
  • 56
  • 115
  • And what is the problem/question? Any exception? – j_freyre Mar 10 '11 at 12:07
  • What exactly is the problem? I also notice you have an extra semi-colon that could be causing a compiler error: -(IBAction) QRScan; – kennbrodhagen Mar 10 '11 at 12:10
  • i show a presentmodalviewcontroller for scanning qr codes, i wanna allow user to have more info on the qr codes by pressing the "i" button. which in turns calling "settingTapped", however some reason it does not work – Desmond Mar 10 '11 at 12:18

2 Answers2

0

You should add settingsTapped function into the _nc viewController, since it will be called from inside a modal view controller (which is _nc), then you would have to present another modal view controller on top of that.

Apple guidelines would recommend that you should "Flip" your info screen and not use another modal view controller. (see how weather app behaves when i is tapped)

Ladislav
  • 7,223
  • 5
  • 27
  • 31
  • how do i put settingtapped function into the nc viewcontroller ? is there any sample to show how does the flip work in modal view ? something like this nc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; ? thanks for replying :) – Desmond Mar 10 '11 at 13:14
  • You should add the code for (i) into SKScannerViewController file ( settingsTapped), and add modal view controller from there. As for the flip view, take a look at: http://stackoverflow.com/questions/843534/flip-view-iphone, the second answer is saying that you can even make a flip view from modal view controller...try it out – Ladislav Mar 10 '11 at 15:35
0

You are trying to present the modal view controller on a modal view controller which is not allowed.
You will have to add the sub view to camera view.

Naveed Rafi
  • 2,503
  • 5
  • 32
  • 40