iOS 实现微信扫一扫样式

-(void)loopDrawLine

{

    CGRect  rect= CGRectMake(0,50, 320, 2);

   if (readLineView) {

      [readLineView removeFromSuperview];

   }

    readLineView = [[UIImageView alloc]initWithFrame:rect];

    readLineView.backgroundColor =[UIColor redColor];

       [UIViewanimateWithDuration:3.0

                         delay: 0.0

                       options:UIViewAnimationOptionCurveEaseIn

                     animations:^{

//修改fream的代码写在这里

                        readLineView.frame =CGRectMake(0, 300,320, 2);

                        [readLineView setAnimationRepeatCount:0];

                        

                     }

                     completion:^(BOOL finished){

                        if(!is_Anmotion) {

                          [self loopDrawLine]; 

                        }

                        

                     }];

       

      if (!is_have) {

          UIImage *hbImage=[UIImage imageNamed:@"DecodeFrameForeground.png"];

          UIImageView *hbImageview=[[UIImageView alloc] initWithImage:hbImage];

          //添加一个背景图片

          CGRect hbImagerect=CGRectMake(0, 0,320, 435);

          [hbImageview setFrame:hbImagerect];

          

          ZBarReaderView *readview = [ZBarReaderView new];

         readview.backgroundColor= [UIColor clearColor];

         readview.frame= CGRectMake(0, 0, 320, 380);

          readview.readerDelegate = self;

          readview.allowsPinchZoom = YES;//使用手势变焦

        readview.trackingColor =[UIColor redColor];

          readview.showsFPS = YES;//显示帧率 YES 显示  NO不显示

          readview.scanCrop = CGRectMake(0, 0,1, 1);//将被扫描的图像的区域

          [readview addSubview:hbImageview];

          [readview addSubview:readLineView];

          [self.view addSubview:readview];

          [readview start];

          is_have = YES;

      }

      [self.view addSubview:readLineView];

}

根据实际情况 自己设置参数 ,需要注意的是 扫描到数据后一定要记得:
[readerViewstop];

[readerViewremoveFromSuperview];

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值