小编Vyk*_*tas的帖子

swift (MapKit) 上的自定义标记图像

我在 MapKit 上使用自定义标记

如何更改自定义标记上的图像宽度和高度?

我的代码:

func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! {

    if (annotation is MKUserLocation) {
        return nil
    }

    let reuseId = "test"

    var anView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId)
    if anView == nil {

        anView = MKAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
        anView.image = UIImage(named:"x2.png")
        anView.canShowCallout = true
    }
    else {
        anView.annotation = annotation
    }
    return anView
}
Run Code Online (Sandbox Code Playgroud)

mapkit ios swift

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

Swift 位置管理器

我在 Swift 中的位置有问题。

在模拟器上工作正常但在设备上不起作用

我使用模拟器 iPhone 6 iOS 8.3 和设备 iPhone 6 iOS 8.3

我的代码:

import UIKit
import CoreLocation

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate,
CLLocationManagerDelegate {

  var window: UIWindow?
  var locationManager: CLLocationManager! = nil
  var isExecutingInBackground = false

  func locationManager(manager: CLLocationManager!,
    didUpdateToLocation newLocation: CLLocation!,
    fromLocation oldLocation: CLLocation!){
      if isExecutingInBackground{
        println(newLocation);
        locationManager.stopUpdatingLocation()
      } else {
        /* We are in the foreground. Do any processing that you wish */
      }
  }

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
 {
    locationManager …
Run Code Online (Sandbox Code Playgroud)

iphone location cllocationmanager ios swift

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

快速从本地获取图像

我真的很需要帮助

我将图像保存到 DocumentDirectory 如何获取此图像并放入 UIImageView?

照片网址:

file:///Users/zoop/Library/Developer/CoreSimulator/Devices/3E9FA5C0-3III-41D3-A6D7-A25FF3424351/data/Containers/Data/Application/7C4D9316-5EB7-4A70-82DC-E76C654sEA20profile

photo uiimageview swift

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

在swift中将十六进制转换为十进制

如何在swift中将十六进制转换为十进制?

我有字符串"423fdf4dfb1115",我需要得到这个=> 18647576781459733.

我试试这个:

let result = UInt8(strtoul("423fdf4dfb1115", nil, 16)) 
Run Code Online (Sandbox Code Playgroud)

但是app崩溃......

我使用这个在线转换:http: //www.binaryhexconverter.com/hex-to-decimal-converter

xcode hex ios swift

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

标签 统计

swift ×4

ios ×3

cllocationmanager ×1

hex ×1

iphone ×1

location ×1

mapkit ×1

photo ×1

uiimageview ×1

xcode ×1