您的位置:首页 > 其它

zxing摄像头支持横屏

2016-05-17 14:42 274 查看
 - (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);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: