0

我是目标 C 的新手。我试图在单击按钮时从当前视图加载新视图,但是当我单击按钮时它执行代码但什么也不做,即不加载新的视图控制器。以下是我的代码...

- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)resultString {
[self dismissModalViewControllerAnimated:YES];

//Display QRCode in string....
NSLog(@"Result::::%@",resultString);

[_qrCodeParser initWithQRString:resultString];
int i=[_qrCodeParser parseQROCode];
sharedInstance=[SharedInstance sharedInstance];
NSLog(@"%@",sharedInstance._medicineData);
if (i==0) {
    _detailView= [[AlarmViewController alloc] initWithNibName:@"AlarmViewController" bundle:nil];
    [self presentViewController:_detailView animated:YES completion:nil];
}

}
4

1 回答 1

0

尝试删除“dismissModalViewControllerAnimated”控制器行,如下所示:

- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)resultString {
//[self dismissModalViewControllerAnimated:YES];

//Display QRCode in string....
NSLog(@"Result::::%@",resultString);

[_qrCodeParser initWithQRString:resultString];
int i=[_qrCodeParser parseQROCode];
sharedInstance=[SharedInstance sharedInstance];
NSLog(@"%@",sharedInstance._medicineData);
if (i==0) 
{
    _detailView= [[AlarmViewController alloc] initWithNibName:@"AlarmViewController" bundle:nil];
    [self presentViewController:_detailView animated:YES completion:nil];
}


}

希望对您有所帮助。

干杯!

于 2013-02-11T09:59:51.167 回答