当相机出现在ZBar SDK中时,是否可以为焦点放置方括号?

时间:2011-11-28 03:43:06

标签: iphone zbar-sdk

我正在尝试在ZBAR SDK的相机视图中放置图像(焦点的方括号)?谁能帮助我需要做什么?谢谢

1 个答案:

答案 0 :(得分: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;
}