Tag: 坐标

如何获得底部y坐标

如何获得obj-c和Swift中视图的左下坐标,即最大y坐标?

CLLocationManager didUpdateLocations不被调用

我正在用Swift学习iOS 8应用程序的开发过程。 我遵循了一个关于Treehouse的教程,它引导您在Swift和iOS 8中构build天气应用程序。 作为应用程序的改进,作者/导师build议使用CLLocationManager来获取设备的位置,以便将其馈入天气API,而不是硬编码的经度和纬度值。 所以在网上阅读各种教程,我已经走了,试图实现这个build议的改进。 我已经将代码负责获取AppDelegate.swift文件中的位置坐标。 AppDelegate.swift代码 import UIKit import CoreLocation @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, CLLocationManagerDelegate { var window: UIWindow? var locationManager: CLLocationManager! var errorOccured: Bool = false var foundLocation: Bool = false var locationStatus: NSString = "Not Started" var location: CLLocationCoordinate2D? var locationName: String? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> […]

GPS和iOS和Android上的位置

我的Android应用程序编程经验有限,iOS上没有。 我的未来项目的一部分是使我的应用程序能够在Android和iOS上使用GPSlogging当前位置。 在Google Earth中,GPS坐标是否可以采用“Universal Transverse Mercator”格式? 如果没有,有没有办法计算出这种格式的坐标? 编辑:任何人都会知道什么格式的函数在各自的API返回?

为什么iOS坐标系很难理解? 只有我?

我正在学习iOS的UIView! 而且我发现我无法理解边界是如何工作的。 例如, 请运行这个代码…并看到红框的移动。 红色框上升! 而白根视图是静态的! 为什么!? 为什么红框上升! ?? 请让我知道OTL! class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let childView : UIView = UIView(frame: CGRect(x: 50, y: 50, width: 200, height: 200) ) childView.backgroundColor = UIColor.red self.view.addSubview(childView) } override func viewDidAppear(_ animated: Bool) { UIView.animate(withDuration: 8, animations: { // I cannot unnerstand how bounds […]

在iPhone上将经度/纬度转换为x / y

我在UIImageView中显示图像,我想将坐标转换为x / y值,以便我可以在此图像上显示城市。 这是我根据我的研究所尝试的: CGFloat height = mapView.frame.size.height; CGFloat width = mapView.frame.size.width; int x = (int) ((width/360.0) * (180 + 8.242493)); //Main lon int y = (int) ((height/180.0) * (90 – 49.993615)); //Mainz lat NSLog(@"x:%iy:%i",x,y); PinView *pinView = [[PinView alloc]initPinViewWithPoint:x andY:y]; [self.view addSubview:pinView]; 这给我167作为x和y = 104,但这个例子应该有值x = 73&y = 294。 mapView是我的UIImageView,只是为了澄清。 所以我第二次尝试使用MKMapKit: CLLocationCoordinate2D coord = […]

将十进制坐标转换为度,分,秒,方向

到目前为止,我有以下几个方面的内容,但是如果没有一堆乱七八糟的陈述,不能弄清楚方向字母的整齐方式。 有任何想法吗? 理想情况下,我想用一个类来扩展CLLocation类来做到这一点。 -(NSString *)nicePosition{ double latitude = [self.latitude doubleValue]; double longitude = [self.longitude doubleValue]; int latSeconds = (int)round(latitude * 3600); int latDegrees = latSeconds / 3600; latSeconds = abs(latSeconds % 3600); int latMinutes = latSeconds / 60; latSeconds %= 60; int longSeconds = (int)round(longitude * 3600); int longDegrees = longSeconds / 3600; longSeconds = […]

如何获取UIWebView中所选文本的坐标(CGRect)?

我有简单的UIWebView与加载的HTML。 我想显示指向选定文本的PopoverView。 我可以得到UIMenuController的menuFrame并使用它的矩形,但是结果并不像我所需要的那样精确。 我可以计算屏幕大小,并得到menuFrame矩形,然后我可以假设哪里可以findselect,但我想知道在哪里select的文本。 一般可能吗?