iOS Swift UIImage动画在执行数据库和Web服务时被击中

时间:2018-12-05 11:31:50

标签: ios swift

动画代码

 let rotation = CABasicAnimation(keyPath: "transform.rotation")
        rotation.fromValue = 0
        rotation.toValue = 2 * Double.pi
        rotation.duration = 1.5
        rotation.repeatCount = Float.infinity
        imgOuter?.layer.add(rotation, forKey: nil)



DB Code

if let image = imgDig?.image, let userLocation = self.minLocation {

                if let _ = cdHarvest { // Update
                    self.cdHarvest?.digImage = UIImagePNGRepresentation(fixOrientation(img: image)) as! NSData
                    self.cdHarvest?.digDate = Date() as NSDate
                    self.cdHarvest?.digAngle = self.angleCaptured
                    self.cdHarvest?.digLat = self.minLocation.0.coordinate.latitude
                    self.cdHarvest?.digLong = self.minLocation.0.coordinate.longitude
                    CoreDataStack.saveContext()
                }

我正在旋转图像以将其显示为进度条。同时显示进度条我正在做一些事情,例如将数据插入db并调用webservice。我的问题是加载条被击中,直到过程完成。如何修复这个问题。我们将不胜感激。

0 个答案:

没有答案