ios – How one can detect iPhone gadget flattened usig digicam

[ad_1]

I’m making an attempt to detect the gadget flattened to the floor to take footage just like the native digicam. Like beneath Screenshot
Native camera

I attempted utilizing CMMotionManager,

      let motioManager = CMMotionManager()
       motioManager.deviceMotionUpdateInterval = 0.2
         
        if (motioManager.isAccelerometerAvailable){
            motioManager.startAccelerometerUpdates(
                to: OperationQueue.present!,
                withHandler: {(accelData: CMAccelerometerData?, errorOC: Error?) in
                    self.outputAccelData(acceleration: accelData!.acceleration)
                })
        }
    
        if  acceleration.x > -0.1 && acceleration.x > -0.1   {
            
            if  acceleration.y < 0.1 && acceleration.y < 0.1 {
 
                UIView.animate(withDuration: 0.05, delay: 0, choices: .curveEaseIn) {
                    
                    self.centerLabel.body.origin.x = self.display.midX-20
                    self.centerLabel.body.origin.y = self.display.midY-20
                } completion: { [self] executed in

}
                    

However I’m not getting a clean output. May anybody assist me out with how you can obtain this?
Thanks upfront
Out put view

[ad_2]

Leave a Reply