小编Poo*_*hah的帖子

Google Map Polyline无法显示并抛出错误

我有Ionic 3应用程序,我已经将其更新为IONIC 4。因此,当我使用适用于iOS 12的xcode 10编译应用程序时,谷歌地图折线不会呈现并抛出错误。对于IONIC 3和ios 11.3,它的渲染效果非常好,但是在更新后,它停止显示:我的代码是:

for (const path of dashedlinePaths) {

  const lineSymbol = {
    path: 'M 0,-1 0,1',
    strokeOpacity: 1,
    scale: 4
  };

  let dashedPath = new google.maps.Polyline({
    path: path,
    geodesic: true,
    strokeOpacity: 0,
    strokeColor: '#ff883c',
    icons: [{
      icon: lineSymbol,
      offset: '0',
      repeat: '20px'
    }]
  });

  dashedPath.setMap(this.googleMap);
}

for (const path of linePaths) {

  let linePath = new google.maps.Polyline({
    path: path,
    geodesic: true,
    strokeColor: '#ff883c',
    strokeOpacity: 1.0,
    strokeWeight: 4
  });

  linePath.setMap(this.googleMap);
}
Run Code Online (Sandbox Code Playgroud)

错误显示如下:

TypeError: null is not …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps-api-3 typescript ionic3

6
推荐指数
1
解决办法
387
查看次数

如何从MKmapview的可见区域获取半径?

我能够获得地图视图的可见矩形以及地图视图的中心点和跨度增量也可以从mkmaap视图方法获得:获得可见的是:mapView.visibleMapRect 使用.获得中心点:map view.centerCoordinate使用并获得span:mapView.region.span使用.

现在我掌握了所有的信息,如何计算可见光的半径?任何人都可以详细解释我吗?

我已经看到了这个问题,但答案是给我跨度不是可见区域的半径.

mkmapview ios swift

5
推荐指数
2
解决办法
5781
查看次数

如何将视频裁剪为特定尺寸?

我已按照此链接裁剪和调整视频大小:

斯威夫特:裁剪和出口视频

我想裁剪视频并将其调整为612*612.我的代码如下:

 let outputPath : NSString = NSString(format: "%@%@", NSTemporaryDirectory(), "output.mov")

    let outputURL : NSURL = NSURL(fileURLWithPath: outputPath as String)!

    let fileManager : NSFileManager = NSFileManager.defaultManager()

    if(fileManager.fileExistsAtPath(outputPath as String))
    {
        let asset : AVURLAsset = AVURLAsset(URL: outputURL, options: nil)
        if let clipVideoTrack: AVAssetTrack = asset.tracksWithMediaType(AVMediaTypeVideo)[0] as? AVAssetTrack
        {

            var videoComposition: AVMutableVideoComposition = AVMutableVideoComposition()
            videoComposition.frameDuration = CMTimeMake(1, 60)

            print(clipVideoTrack.naturalSize.height)

            videoComposition.renderSize = CGSizeMake(612,612)

            var instruction: AVMutableVideoCompositionInstruction = AVMutableVideoCompositionInstruction()
            instruction.timeRange = CMTimeRangeMake(kCMTimeZero, CMTimeMakeWithSeconds(60, 30))
            var transformer: AVMutableVideoCompositionLayerInstruction =
            AVMutableVideoCompositionLayerInstruction(assetTrack: clipVideoTrack)

            var t1: …
Run Code Online (Sandbox Code Playgroud)

video ios swift

5
推荐指数
1
解决办法
1453
查看次数

如何获取视频的最后一帧?

我想要视频的最后一帧,我的代码如下所示:

let asset : AVURLAsset = AVURLAsset(URL: videoURL, options: nil)
    let generate : AVAssetImageGenerator = AVAssetImageGenerator(asset: asset)
    generate.appliesPreferredTrackTransform = true

    var err : NSError? = nil
    var lastFrameTime = Int64(CMTimeGetSeconds(asset.duration))
    let time : CMTime = CMTimeMake(lastFrameTime, 30)
    let imgRef : CGImageRef = generate.copyCGImageAtTime(time, actualTime: nil, error: &err)
    let img : UIImage = UIImage(CGImage: imgRef)!
Run Code Online (Sandbox Code Playgroud)

但我没有得到最后一帧,我得到了第一帧,请为我提供解决方案。

video ios swift

5
推荐指数
1
解决办法
3717
查看次数

如何使用swift 3 xcode 8在核心数据中预加载数据库

我有一个包含数据的数据库,我想在应用程序中预加载它.在swift 3之前,它可以工作,我已经按照本教程:http://www.appcoda.com/core-data-preload-sqlite-database/但是如何为swift 3加载相同的数据库?正如NSPersistentContainer我所介绍的,如何加载我项目中的.sqlite文件?

xcode ios swift swift3 xcode8

4
推荐指数
1
解决办法
2953
查看次数

如何在swift中检测谷歌地图的摄像头位置

我在搜索了idleAtCameraPosition和didChangeCameraPosition之后知道了这个方法在地图移动时被调用.我如何为swift编写这个方法?我已将委托设置为CLLocationManagerDelegate和GMSMapViewDelegate,但仍未调用此方法.我写的方法如下:

func mapView(mapView: GMSMapView!, didChangeCameraPosition position: GMSCameraPosition!) {
                print(position)
}

func mapView(mapView:GMSMapView!,idleAtCameraPosition position:GMSCameraPosition!)
{
    print(position)

}
Run Code Online (Sandbox Code Playgroud)

但是我的方法没有被调用.此外,我想自定义信息窗口就像在这里完成:谷歌地图的自定义信息窗口.但是在swift中找不到如何做同样的方法.我是新手,所以不要这么做.

google-maps ios swift

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

如何在单击按钮时使标签可编辑并显示键盘以输入文本?

我想要一个“编辑”按钮,以便能够更改我的标签文本。

在此处输入图片说明

我需要使用键盘来编写新文本。我的意思是我知道如何制作一个按钮,label.text = "new label"但我想让用户可以用他的键盘更改标签文本。我尝试使用文本视图,但我们无法(我自己和互联网上都没有找到任何解决方案)制作一个按钮,可以将我们重定向到文本视图以更改文本。

我经常使用故事板,所以如果你有一个故事板解决方案,那将是完美的,但我也会理解 Objective-C 和 Swift :)

谢谢!

编辑:谢谢 Henrique da Costa,解决方案是放入[TextView becomeFirstResponder];按钮动作。TextView.becomeFirstResponder()在斯威夫特。

objective-c storyboard ios swift

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

如何从BLE器件的Arraybuffer获取值读取特征值

我已经阅读了IONIC 2的文档,其中包括https://ionicframework.com/docs/v2/native/ble/.从那里给出了arraybuffer到string的转换,这对我来说不起作用.如图所示图片

如何从读取特性中获取此数据的固件版本作为IONIC 2的Arraybuffer转换代码,这 function bytesToString(buffer) { return String.fromCharCode.apply(null, new Uint8Array(buffer)); } 对我来说不起作用.使用该代码我得到输出:îÍy}ùt.我是离子的新手.我有字节传输顺序最低有效八位字节(即小端).请提供转换解决方案.谢谢.

android ios ionic2 angular

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

谷歌共享无需登录即可工作

我的共享代码如下:

id<GPPShareBuilder> shareBuilder = [[GPPShare sharedInstance] shareDialog];

// This line will fill out the title, description, and thumbnail from
// the URL that you are sharing and includes a link to that URL.

[shareBuilder setTitle:@"Try Sharing g+" description:@"demo" thumbnailURL:nil];

[shareBuilder open];
if (![shareBuilder open]) {
    NSLog(@"Status: error (see console)....");
}
Run Code Online (Sandbox Code Playgroud)

但我得到的错误如下:

由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'您必须指定| clientID | for | GPPSignIn |'

从谷歌开发者链接https://developers.google.com/+/mobile/ios/share/basic-share它说我可以分享而无需登录谷歌+,仍然无法正常工作.请提出一些解决方案.

ios google-plus

0
推荐指数
1
解决办法
1373
查看次数