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);
}
}
{
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);
}
}
相关文章推荐
- 南阳理工oj_The Triangle
- Android Studio无法创建新的Activity报出ide internal error occurred错
- 第10、11周-程序阅读补充(1)
- php 上传csv文件
- OpenMP常用指令释义
- jQuery扩展方法
- 南阳理工oj_The Triangle
- nginx+nagios使用用户名密码鉴权设置
- spring jdbcTemplate query
- 下拉框combobox用法&级联餐单
- PHP中的11个魔术方法总结:__construct,、__destruct、__call等
- OC关联objc_setAssociatedObject
- LeetCode-263&264.Ugly Number
- 获取数组的最小值
- RabbitMQ在分布式系统的应用
- 架构漫谈(七):不要空设架构师这个职位,给他实权
- 有关ios硬件的部分的
- 122. Best Time to Buy and Sell Stock II
- Pascal's Triangle II
- PS结合Magic Morph制作一张趣味的动态图