我有一个 Ipad 应用程序,我正在尝试执行一些条形码读取过程。当我按下主页中的按钮时,我正在呈现条形码读取 viewcontrollers 视图,如下所示`
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;
reader.sourceType=UIImagePickerControllerSourceTypeCamera;
//reader.cameraDevice = UIImagePickerControllerCameraDeviceFront;
reader.cameraOverlayView=cameraOverlay;
if( [UIImagePickerController isCameraDeviceAvailable: UIImagePickerControllerCameraDeviceFront ])
{
reader.cameraDevice = UIImagePickerControllerCameraDeviceFront;
}
ZBarImageScanner *scanner = reader.scanner;
reader.wantsFullScreenLayout = YES;
// TODO: (optional) additional reader configuration here
// EXAMPLE: disable rarely used I2/5 to improve performance
[scanner setSymbology: ZBAR_I25
config: ZBAR_CFG_ENABLE
to: 0];
reader.showsZBarControls = NO;
// present and release the controller
[self presentModalViewController:reader animated:YES];
//[appdel.navigationController pushViewController:reader animated:YES];
//[reader.view addSubview:collect];
[reader.view addSubview:back];
[back addTarget:self action:@selector(backpressed:) forControlEvents:UIControlEventTouchUpInside];
[reader.view addSubview:scan];
[scan addTarget:self action:@selector(getpressed:) forControlEvents:UIControlEventTouchUpInside];
[reader release];
当我按下添加到阅读器视图的扫描按钮时,我需要添加另一个视图。我正在这样做。-(IBAction)getpressed:(id)sender{[self.view addSubview:newview] }
但它没有添加到视图中。有人可以帮我实现这一点吗?`