是的,你先設置一些屬性爲您ZBarReaderViewController
self.zReader.showsCameraControls = NO;
self.zReader.showsZBarControls=NO;
然後,你必須設置自定義cameraOverlayView
,例如這個設置UIToolBar
用左按鈕關閉選擇器和UISwitch
控制在flashMode:
self.zReader.cameraOverlayView=[self setOverlayPickerView];
- (UIView *)setOverlayPickerView{
UIView *v=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[v setBackgroundColor:[UIColor clearColor]];
UIToolbar *myToolBar = [[UIToolbar alloc] init];
UIBarButtonItem *backButton=[[UIBarButtonItem alloc] initWithTitle:@"back" style:UIBarButtonItemStyleBordered target:self action:@selector(dismissOverlayView:)];
UISwitch *sw=[[UISwitch alloc] init];
[sw setOn:NO];
UIBarButtonItem *switchButton=[[UIBarButtonItem alloc] initWithCustomView:sw];
UIBarButtonItem *fixed=[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
[sw addTarget:self action:@selector(handleSwitchFlash:) forControlEvents:UIControlEventValueChanged];
[myToolBar setItems:[NSArray arrayWithObjects:backButton,fixed,switchButton,nil]];
[myToolBar setBarStyle:UIBarStyleDefault];
CGRect toolBarFrame;
toolBarFrame = CGRectMake(0, 436, 320, 44);
[myToolBar setFrame:toolBarFrame];
[v addSubview:myToolBar];
return v;
}
- (void)dismissOverlayView:(id)sender{
[self dismissModalViewControllerAnimated: YES];
}
來源
2012-04-13 20:16:35
Mat
它確實幫助了我。我試過了,它工作。你知道我們如何從nib加載視圖而不是編程呢? – tranvutuan 2012-04-14 18:47:54
您可以創建一個普通的UIViewController(帶有一個xib)並將其視圖傳遞給'cameraOverlayView'。 – Mat 2012-04-14 19:02:18
我剛剛給了它一個嘗試..請看看我的另一篇文章在[鏈接](http://stackoverflow.com/questions/10156930/customization-of-the-camera-overlay) – tranvutuan 2012-04-14 20:06:07