Iphone 当前模态视图问题
我使用的是二维码SDK当按下按钮时,它会有一个presentModalView在那里我得到了一个信息按钮。我想让它链接到另一个笔尖,以显示如何工作的信息Iphone 当前模态视图问题,iphone,xcode,ios,presentmodalviewcontroller,Iphone,Xcode,Ios,Presentmodalviewcontroller,我使用的是二维码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).
-(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];
}
您应该将settingsTapped函数添加到_ncviewcontroller中,因为它将从模态视图控制器(即_nc)内部调用,因此您必须在其上显示另一个模态视图控制器
苹果的指导方针建议你应该“翻转”你的信息屏幕,不要使用另一个模态视图控制器。(请参见点击“我”时天气应用程序的行为)您试图在不允许的模式视图控制器上显示模式视图控制器。
您必须将子视图添加到摄影机视图。问题是什么?有例外吗?到底是什么问题?我还注意到您有一个额外的分号,可能会导致编译器错误:-(IBAction)QRScan;我展示了一个用于扫描二维码的presentmodalviewcontroller,我想让用户通过按“i”按钮获得更多关于二维码的信息。依次调用“settingTapped”,但由于某些原因,它不起作用。如何将settingTapped功能放入nc viewcontroller?是否有任何示例显示翻转如何在模态视图中工作?类似这样的nc.modAltTransitionStyle=UIModAltTransitionStyleFlipHorizontal?感谢回复:)您应该将(i)的代码添加到SKScannerViewController文件(settingsTapped)中,并从此处添加模态视图控制器。至于翻转视图,请看:,第二个答案是,您甚至可以从模态视图控制器创建翻转视图……试试看