- 浏览: 2479041 次
- 性别:
- 来自: 苏州
文章分类
最新评论
-
jsntghf:
peio 写道这个怎么运行?Ruby On Rails的环境搭 ...
多文件上传之uploadify -
peio:
这个怎么运行?
多文件上传之uploadify -
往事如烟1:
我的项目是自己init了一个原始的project,之后将ver ...
React Native热部署之CodePush -
jsntghf:
<div class="quote_title ...
React Native热部署之CodePush -
往事如烟1:
我按照你的说明进行,发现app退出之后,在进入不正确,请问是什 ...
React Native热部署之CodePush
首先,需要将CoreLocation.framework和MapKit.framework加入到项目中。
头文件:
#import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> #import <MapKit/MapKit.h> @interface LocationViewController : UIViewController <CLLocationManagerDelegate> { CLLocationManager *locationManager; CLLocation *myLocation; IBOutlet UIButton *getLocationBtn; IBOutlet UILabel *latitudeLabel; IBOutlet UILabel *longitudeLabel; IBOutlet MKMapView *mapView; } @property (nonatomic, retain) CLLocationManager *locationManager; @property (nonatomic, retain) CLLocation *myLocation; @property (nonatomic, retain) UIButton *getLocationBtn; @property (nonatomic, retain) UILabel *latitudeLabel; @property (nonatomic, retain) UILabel *longitudeLabel; @property (nonatomic, retain) MKMapView *mapView; - (IBAction) getLocationBtnClicked:(id) sender; - (void) initMapView; - (void) initLocation; @end
实现文件:
#import "LocationViewController.h" @implementation LocationViewController @synthesize locationManager; @synthesize myLocation; @synthesize getLocationBtn; @synthesize latitudeLabel; @synthesize longitudeLabel; @synthesize mapView; - (void)viewDidLoad { [self initMapView]; [self initLocation]; [super viewDidLoad]; } //初始化地图显示参数 - (void) initMapView { //设定显示中心经纬度 CLLocationCoordinate2D theCoordinate; theCoordinate.latitude = 38.148926; theCoordinate.longitude = -120.715542; //设定显示范围 MKCoordinateSpan theSpan; theSpan.latitudeDelta = 0.1; theSpan.longitudeDelta = 0.1; //设置地图显示的中心及范围 MKCoordinateRegion theRegion; theRegion.center = theCoordinate; theRegion.span = theSpan; //设置地图显示的类型及根据范围进行显示 [self.mapView setMapType:MKMapTypeStandard]; [mapView setRegion:theRegion]; [mapView regionThatFits:theRegion]; //定位后在地图上用蓝色点显示用户的位置 mapView.showsUserLocation = YES; } //初始化定位相关参数 - (void) initLocation { self.locationManager = [[CLLocationManager alloc] init]; //设置代理 locationManager.delegate = self; //设置需要的定位精度 locationManager.desiredAccuracy = kCLLocationAccuracyBest; latitudeLabel.text = @""; longitudeLabel.text = @""; } - (IBAction) getLocationBtnClicked:(id) sender { latitudeLabel.text = @""; longitudeLabel.text = @""; //启动定位 [locationManager startUpdatingLocation]; } - (void)dealloc { [locationManager release]; [myLocation release]; [getLocationBtn release]; [latitudeLabel release]; [longitudeLabel release]; [mapView release]; [super dealloc]; } //代理方法 #pragma mark - #pragma mark CLLocationManagerDelegate Methods //确定当前位置和位置更新了时调用这个方法 - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { //获得定位点的纬度信息 NSString *latitudeString = [[NSString alloc] initWithFormat:@"%g", newLocation.coordinate.latitude]; latitudeLabel.text = latitudeString; [latitudeString release]; //获得定位点的经度信息 NSString *longitudeString = [[NSString alloc] initWithFormat:@"%g", newLocation.coordinate.longitude]; longitudeLabel.text = longitudeString; [longitudeString release]; //停止定位 [locationManager stopUpdatingLocation]; //把地图中心移动到定位到的这个点 [mapView setCenterCoordinate:newLocation.coordinate animated:YES]; //重新设置地图显示的区域 MKCoordinateSpan newSpan; newSpan.latitudeDelta = 0.05; newSpan.longitudeDelta = 0.05; MKCoordinateRegion newRegion; newRegion.center = newLocation.coordinate; newRegion.span = newSpan; [mapView setRegion:newRegion animated:YES]; } //位置查询遇到错误时调用这个方法 - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { NSString *errorType = (error.code == kCLErrorDenied) ? @"Access Denied" : @"Unknown Error"; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error getting Location" message:errorType delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; } @end
发表评论
-
Error watching file for changes: EMFILE
2016-12-15 11:57 1240执行npm start后报错: Error watc ... -
CocoaPods升级1.1.1报错
2016-12-15 08:39 743ERROR: While executing gem .. ... -
Visual Studio Code运行React Native报错
2016-06-13 09:43 1562React Native:0.27.2 React:15 ... -
React Native 0.27.2编译报错this._nativeModule.addListener is not a function
2016-06-12 15:21 3797React Native:0.27.2 React:15 ... -
Unable to resolve module ReactDefaultPerf from
2016-06-02 13:04 2736package.json信息如下: "reac ... -
React Native 0.26.2编译报错Undefined symbols for architecture x86_64
2016-05-26 11:15 1952React Native:0.26.2 React:15. ... -
Failed to update auto layout status: Failed to load designables from path (null)
2016-04-05 22:11 1670确保CocoaPods是0.36.1以上版本,然后在podf ... -
集成微信支付出现Undefined symbols for architecture x86_64错误
2016-03-21 13:22 1687Undefined symbols for architec ... -
React Native热部署之CodePush
2016-01-10 22:27 6136本文使用的环境是Mac OS 10.11.1、Xcode ... -
浅谈React Native中的FlexBox布局
2015-11-17 18:38 4275React Native通过一个基于FlexBox的布局引 ... -
React Native之构建一个简单的列表页
2015-10-23 14:45 2101本文中我们将创建一个简单的电影应用,这个应用将从Rotten ... -
React Native之环境搭建
2015-10-20 16:30 1396本文使用的环境是Mac O ... -
获取图片属性的方法
2015-10-18 20:43 3085很多时候我们需要获 ... -
NSCache的下标用法
2015-09-18 00:19 1173NSCache类和NSDictionary类很相似,也提供 ... -
如何给category添加属性
2015-08-16 10:41 646主要是使用了runtime中的associative机制。 ... -
UITableView的两种重用Cell方法的区别
2015-08-10 13:07 16069UITableView中有两种重用Cell的方法: - ... -
SDImageCache.m报错Unused variable 'fileName'
2015-08-04 21:56 1137GCC手册中的相关解释: unused:This att ... -
Swift调用Objective-C
2015-07-13 23:33 1180Swift调用Objective-C需要一个名为<工程 ... -
使用GCD实现倒计时
2015-07-24 21:47 1048__block int timeout = 60; // ... -
导航栏加分割线的实现
2015-07-01 22:00 1695self.view.backgroundColor = [U ...
相关推荐
一个Vue与Openlayers结合的应用示例,以组件的方式在Vue中使用openlayers地图,以及可以进行简单的地图配置
本示例提供给Android初学者一个了解并初步运用百度地图提供的接口来开发设计地图的APP的方法,简单易懂可以借鉴一下
主要分享一段了Google Maps API地图应用示例,做项目中经常会使用到,非常的简单,有需要的朋友可以参考下
带有 Google Maps 和 Cypress 自动化测试的 Quasar 应用示例 技术: 类星体 v1 谷歌地图 API 谷歌地图地方 API 谷歌地图路线 API 柏 客观的 您将学习如何使用 Google Maps API 在 Quasar 应用程序中添加标记、...
此自述文件通常会记录启动和运行应用程序所需的任何步骤。 您可能想要涵盖的内容: Ruby版 系统依赖 配置 数据库创建 数据库初始化 如何运行测试套件 服务(作业队列、缓存服务器、搜索引擎等) 部署说明 … ...
导游根据 MVC 规则构建的简单 java 应用程序的示例。 MySQL 5.5.36、NetBeans 8.0 用于创建应用程序。 和 Java 8.0。 该应用程序适用于两种类型的用户。 一些游客会在 Erdut 市搜索所需的兴趣点,寻找住宿、食物和...
地图测试谷歌地图示例应用程序使用的工具后端Django(Python 网络框架) Django Rest Framework(基于 Django 的 REST 框架) Postgis(PostgreSQL 的空间和地理对象)前端Angularjs(Javascript 框架) Bootstrap...
zkoss 集成百度地图的示例,简单的集成了百度地图样例,提供一个入口性质的参考,高阶应用按照百度地图的应用即可
js格式,直接调用简单直接,但是数据只有全国概览和各省的数据,也就是只能看到地市级城市的地图。 json格式在html中不能直接调用执行,需要通过应用服务器,所以提供了jsp示例。 json格式的数据,提供了全国概览...
一、简介 1、地图 地图展示:普通地图(2D,3D)、卫星图和实时交通图。 地图操作:可通过接口或手势控制来实现地图的点击、双击、长按、缩放、平移、旋转、改变视角等操作...(1)创建一张最简单的百度地图;
js格式,直接调用简单直接,但是数据只有全国概览和各省的数据,也就是只能看到地市级城市的地图。 json格式在html中不能直接调用执行,需要通过应用服务器,所以提供了jsp示例。 json格式的数据,提供了全国概览...
这是使用ReactJS开发简单的Todo应用程序的示例。 要求 MongoDB 节点JS ReactJS Redux(此应用程序不使用Redux-Form) 使用的依赖 后端 body-parser@1.15.2:请求的解析器主体(读取参数并转换为Javascript...
在此示例应用程序中,我使用了SEMBAST(简单嵌入式应用程序商店),它是一个功能强大但使用简单的库,用于存储,查询,排序,分页甚至加密数据。 支持的类型 串 num(整数和双精度) 地图 清单 布尔 空值 其他资源...
行星 - Apple-Watch 一个简单的 Apple Watch 示例应用程序演示在 Apple Watch 上可用的两种导航类型,分层的和基于页面的。 还演示了组、tableviews、segue(程序和故事板)动画(使用图像)和地图视图。
用于学习SQL注入的简单示例Web应用程序。 此示例应用程序是用于注册图像文件及其关联信息的成员资格站点。 该示例应用程序包含以下各项: PHP PostgreSQL 阿帕奇 先决条件 码头工人 码头工人组成 网站地图 *SQL...
本文实例讲述了Android仿百度谷歌搜索自动提示框AutoCompleteTextView简单应用。分享给大家供大家参考,具体如下: 现在我们上网几乎都会用百度或者谷歌搜索信息,当我们在输入框里输入一两个字后,就会自动提示我们想...
在这个离子应用程序示例中,我们将讨论基于位置的应用程序时最重要的三个功能Google地图,地理位置和Google地方信息合并为一个功能简单且易于理解的示例,因此您可以掌握基于位置的应用程序背后的概念。 本离子教程...
简单轨道SimpleTracks 是一个示例应用程序,它演示了 Windows Phone 8.1 中 TrackPoint Monitor API 的用法。 此应用程序可视化地图上的轨迹。 用户可以使用应用程序栏按钮查看过去 7 天的曲目以及曲目历史记录。 ...
这是一个简单的应用程序,可在世界地图上实时向所有连接的客户端显示从IP地址提取的位置。 例如,可以使用此应用来显示您的用户在世界范围内的活动。 该应用程序使用框架和将事件推送到客户端。 IP地址的地理位置...
获取密钥之前我们要新建一个应用 填写好相关的信息 二、 新建一个项目工程 1、 把下载好的百度sdk中的jar包拷贝到项目的libs目录下 2、在application中添加开发密钥 3、添加所需的权限 <uses-permission ...