小编Ela*_*van的帖子

如何在GMSMapView中获取动画折线路径,以便在移动地图时它与地图一起移动?

我已经通过以下代码创建了像CAShapeLayer的动画折线,我已经将CAShapeLayer添加为GMSMapiew的子图层,但是,如果我移动地图,图层将不会移动.在哪里添加图层,以便它与地图一起移动?

   func layer(from path: GMSPath) -> CAShapeLayer {
        let breizerPath = UIBezierPath()
        let firstCoordinate: CLLocationCoordinate2D = path.coordinate(at: 0)
        breizerPath.move(to: self.mapView.projection.point(for: firstCoordinate))
        for i in 1 ..< Int((path.count())){
            print(path.coordinate(at: UInt(i)))
            let coordinate: CLLocationCoordinate2D = path.coordinate(at: UInt(i))
            breizerPath.addLine(to: self.mapView.projection.point(for: coordinate))
        }

        let shapeLayer = CAShapeLayer()
        shapeLayer.path = breizerPath.reversing().cgPath
        shapeLayer.strokeColor = UIColor.green.cgColor
        shapeLayer.lineWidth = 4.0
        shapeLayer.fillColor = UIColor.clear.cgColor
        shapeLayer.lineJoin = kCALineJoinRound
        shapeLayer.lineCap = kCALineCapRound
        shapeLayer.cornerRadius = 5
        return shapeLayer
    }

    func animatePath(_ layer: CAShapeLayer) {
        let pathAnimation = CABasicAnimation(keyPath: "strokeEnd")
        pathAnimation.duration = 6 …
Run Code Online (Sandbox Code Playgroud)

ios google-maps-sdk-ios gmsmapview swift

19
推荐指数
2
解决办法
1万
查看次数

当尝试使用Fabric Twitter SDK获取Twitter用户的电子邮件地址时,显示"您的应用程序可能无法访问电子邮件地址"

我想请求用户的Twitter邮件.在https://dev.twitter.com/twitter-kit/ios/request-email上

代码是:

if ([[Twitter sharedInstance] session]) {
    TWTRShareEmailViewController* shareEmailViewController =
    [[TWTRShareEmailViewController alloc]
     initWithCompletion:^(NSString* email, NSError* error) {
         if (error)
         {
            NSLog(@"Error  %@",error.localizedDescription);

         }else
         {
             NSLog(@"Email %@",email);
         }

     }];
    [self presentViewController:shareEmailViewController
                       animated:YES
                     completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

email twitter ios

3
推荐指数
1
解决办法
1246
查看次数

标签 统计

ios ×2

email ×1

gmsmapview ×1

google-maps-sdk-ios ×1

swift ×1

twitter ×1