小编Mic*_*edo的帖子

谷歌地图标记精灵图像位置

我们如何将精灵图像定位为Google地图标记.例如:在css中,我们将图像定位为

background: url('../images/bodycss/pointer.png') 28px -32px;
Run Code Online (Sandbox Code Playgroud)

现在我如何将以上代码包含在下面的google api-v3功能中?

function setMarkers(map, markers) {

    var google_image = new google.maps.MarkerImage("http://example.com/images/bodycss/pointer.png");

    for (var i = 0; i < markers.length; i++) {
        var sites = markers[i];
        var siteLatLng = new google.maps.LatLng(sites[1], sites[2]);
        var marker = new google.maps.Marker({
            position: siteLatLng,
            map: map,
            title: sites[0],
            zIndex: sites[3],
            html: sites[4],
            icon: google_image
        });

        google.maps.event.addListener(marker, "mouseover", function () {
            infowindow.setContent(this.html);
            infowindow.open(map, this);
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript image sprite google-maps-api-3

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

可以在目标c中使用swift中的数组简化概念吗?

我在Swift中有这行代码:

let graphPoints:[Int] = [4, 2, 6, 4, 5, 8, 3]

let average = graphPoints.reduce(0, combine: +) / graphPoints.count
Run Code Online (Sandbox Code Playgroud)

可以在目标c代码中"翻译"这行代码吗?

对于我来说,减少组合概念的工作原理并不是很清楚.我读过它但仍不清楚.

我从本教程中获取了代码:http://www.raywenderlich.com/90693/modern-core-graphics-with-swift-part-2

请帮忙.谢谢.

arrays reduce ios swift

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

如果让 - 多个条件

我可以在 IF 中使用 let obj = Something 的多个条件吗

if let u = custom["u"] as? String || let url = custom["URL"] as? String
{
// Do something here
}
Run Code Online (Sandbox Code Playgroud)

ios swift swift2 option-type

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

如何在iOS中使用NSURLConnection调用webService

实际上,我现在使用JSON类来调用Web服务,但是现在我想使用NSURLConnection任何为我提供代码的Web服务来调用该Web服务。

请向我提供我必须导入的框架的详细信息。

先感谢您。

objective-c nsurlconnection ios sendasynchronousrequest

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

How do I convert coordinates in SpriteKit?

I'm trying to grasp the conversion thing in SpriteKit but despite having read the documentation and several posts on SO I can't seem to get it right. As far as I understand there are two coordinate systems that work independently of one another, one for the scene and one for the view, which is why I simply can't use the things like UIScreen.main.bounds.maxX to determine screen corners that the node can relate to. Am I getting this right?

Anyway, …

coordinate-transformation ios sprite-kit skshapenode swift

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

我如何在另一个课程中访问IBOutlet?迅速

对不起,我的英语能力很差。

我想在另一个类中访问IBOutlet。我在stackoverflow中发现了许多问题,但是所有答案在我的代码中均不起作用

首先,这是我的代码。

ViewController.swift

import UIKit

class ViewController: UIViewController {

@IBOutlet var MainViewController: UIView! = nil
@IBOutlet var LyricsViewController: UIView! = nil
@IBOutlet var ListViewController: UIView! = nil
override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

   showMainViewController()    
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

func showMainViewController(){
    MainViewController.alpha = 1
    LyricsViewController.alpha = 0
    ListViewController.alpha = 0
}
func showLyricsViewController(){
    MainViewController.alpha = 0 …
Run Code Online (Sandbox Code Playgroud)

iboutlet ios swift

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