2011-11-28 26 views

回答

2

您可以設置相機屏幕覆蓋以設置cameraOverlayView屬性。設計一個視圖,按您的要求,併爲其分配:

reader.cameraOverlayView = [self CommomOverlay]; 

-(UIView *)CommomOverlay{ 
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)]; 

    UIImageView *TopBar = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,58)]; 
    [TopBar setImage:[UIImage imageNamed:@"topbar.png"]]; 
    [view addSubview:TopBar]; 

    UILabel *Toplabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 9, 300, 30)]; 
    [Toplabel setFont:[UIFont fontWithName:@"Arial-BoldMT" size:11]]; 
    [Toplabel setTextAlignment:UITextAlignmentCenter]; 
    [Toplabel setBackgroundColor:[UIColor clearColor]]; 
    [Toplabel setTextColor:[UIColor colorWithRed:76/255.0 green:76/255.0 blue:76/255.0 alpha:1.0]]; 
    [Toplabel setNumberOfLines:1]; 
    [Toplabel setText:@"Scan now "]; 
    [TopBar addSubview:Toplabel]; 

    UIImageView *FrameImg = [[UIImageView alloc] initWithFrame:CGRectMake(60,150,193,170)]; 
    [FrameImg setImage:[UIImage imageNamed:@"frame.png"]]; 
    [view addSubview:FrameImg]; 
    return view; 
} 
+0

阿維納什是正確的,我想ü指向文檔 http://zbar.sourceforge.net/iphone/sdkdoc/ZBarReaderController.html?highlight = overlay#cameraOverlayView__UIViewP 你只需要使用一個UIView,它可以有任何圖像並將它用作覆蓋;我以前做過這些,但抱歉,我沒有與我的代碼,如果仍然需要,我可以很快發佈 – Veeru

相關問題