zoukankan      html  css  js  c++  java
  • 使用ZXingObjC扫描二维码横竖屏对应

    /**
     根据屏幕的方向设置扫描的方向
     * @author maguang
     * @param parameter
     * @return result
     */
    - (void)showaCapture
    {
        CGAffineTransform transform;
        if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
        {
            self.capture.rotation = 180.0f;
            transform = CGAffineTransformMakeRotation(M_PI/2);
        }
        else if (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight)
        {
            self.capture.rotation = 0.0f;
            transform = CGAffineTransformMakeRotation(-M_PI/2);
        }
        else if (self.interfaceOrientation == UIInterfaceOrientationPortrait)
        {
            self.capture.rotation = 90.0f;
            transform = CGAffineTransformMakeRotation(0);
        }
        else if (self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
        {
            self.capture.rotation = 270.0f;
            transform = CGAffineTransformMakeRotation(M_PI);
        }
        
        [self.capture setTransform:transform];
        CGRect f = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
        self.view.layer.frame=f;
        self.capture.layer.frame = f;
    }

    1、在 - (void)viewWillAppear:(BOOL)animated

    方法中调用上面的方法。

    2、同时在响应屏幕旋转的方法中调用这个方法。

  • 相关阅读:
    软件的一般实现过程
    前端开发所需技能及理解
    前端开发所需技能
    JavaScriptlet和const的使用
    [NOI2013] 向量内积
    [省选联考 2021 A/B 卷] 滚榜
    [提高组集训2021] 模拟赛2
    [省选联考 2021 A 卷] 矩阵游戏
    [省选联考 2021 A/B 卷] 图函数
    [APIO2020] 交换城市
  • 原文地址:https://www.cnblogs.com/mgbert/p/3952818.html
Copyright © 2011-2022 走看看