Is it possible to put a square bracket for the focus when the camera appears in the ZBar SDK?

柔情痞子 提交于 2019-12-12 09:28:52

问题


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


回答1:


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;
}


来源:https://stackoverflow.com/questions/8291299/is-it-possible-to-put-a-square-bracket-for-the-focus-when-the-camera-appears-in

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!