0

I'm trying to place an image (a square bracket for the focus) in the camera view of the ZBAR SDK? Can anyone please help me what needs to be done? thanks

WrightsCS
  • 50,551
  • 22
  • 134
  • 186
Jahn
  • 97
  • 2
  • 10

1 Answers1

2

You can set overlay of camera screen to set the cameraOverlayView property. Design a view as per your requirement and assign it:

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;
}
Emil
  • 7,220
  • 17
  • 76
  • 135
aViNaSh
  • 1,318
  • 14
  • 15
  • aVinaSh is right, i would like to point u to the documentation http://zbar.sourceforge.net/iphone/sdkdoc/ZBarReaderController.html?highlight=overlay#cameraOverlayView__UIViewP You just have to use a UIView, which can have any image and use it as overlay; i have done this before, but sorry i dont have the code with me, i can post sometime soon if still needed – Veeru Jan 21 '12 at 13:17