0

在此处输入图像描述按下按钮时,我使用的是 QR 码 SDK,它将有一个 presentModalView 我有一个信息按钮。我希望它链接到另一个笔尖以显示有关它如何工作的信息!

-(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];
}
4

2 回答 2

0

您应该将 settingsTapped 函数添加到 _nc viewController 中,因为它将从模态视图控制器(即 _nc)内部调用,然后您必须在其之上呈现另一个模态视图控制器。

Apple 指南建议您应该“翻转”您的信息屏幕,而不是使用另一个模态视图控制器。(查看点击我时天气应用程序的行为)

于 2011-03-10T12:50:37.557 回答
0

您试图在不允许的模态视图控制器上显示模态视图控制器。
您必须将子视图添加到相机视图。

于 2011-03-29T08:47:00.637 回答