• 使用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、同时在响应屏幕旋转的方法中调用这个方法。

  • 相关阅读:
    sql server执行存储过程慢的问题
    Windows service
    moss网站模板的一些问题
    ACM题解报告——HD1012
    ACM题解报告——HD1496
    ACM题解报告——HD1253
    ACM题解报告——进制数取于余
    ACM题解报告——HD1058
    ACM题解报告——HD1548
    ACM解题报告HD1015
  • 原文地址:https://www.cnblogs.com/mgbert/p/3952818.html
Copyright © 2020-2023  润新知