我是客观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];
}
}
答案 0 :(得分: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];
}
}
希望它对你有所帮助。
干杯!