1
我在我試圖做一些條形碼讀取processes.when我在主頁上按下一個按鈕,我提出的條形碼讀取viewcontrollers一個iPad應用程序中查看像this`如何在當前視圖控制器視圖上添加UIview?
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] }
。但它不被添加到視圖。任何人都可以幫助我實現這一點? `
試着用'[self.view addSubView:newView.view]'? – Phillip
您是否檢查了getpressed方法被調用?誰是新視點? – giorashc
是[self.view addSubView:newView.view]它沒有試過 – hacker