zxing摄像头支持横屏

来源:互联网 发布:私募通数据库 编辑:程序博客网 时间:2024/05/29 12:04

 

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{      float space=(SCREEN_WIDTH>SCREEN_HEIGHE?(SCREEN_WIDTH-SCREEN_HEIGHE):(SCREEN_HEIGHE-SCREEN_WIDTH))/2;    [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];    self.capture.delegate = self;    self.capture.layer.anchorPoint=CGPointMake(0.5, 0.5);    if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {        self.capture.layer.frame = CGRectMake(-space, space, SCREEN_WIDTH,SCREEN_HEIGHE);        CATransform3D transform = CATransform3DMakeRotation(0, 0, 0, 1);        self.capture.layer.transform = transform;        NSLog(@"==%f",SCREEN_WIDTH);    }else{        self.capture.layer.position=self.view.center;        self.capture.layer.frame = CGRectMake(space, -space, SCREEN_WIDTH,SCREEN_HEIGHE);        CATransform3D transform = CATransform3DMakeRotation(M_PI_2, 0, 0, 1);        self.capture.layer.transform = transform;        NSLog(@"--%f",SCREEN_WIDTH);    }}

0 0
原创粉丝点击