#import <UIKit/UIKit.h>

 @interface AppDelegate : UIResponder <UIApplicationDelegate>

 @property (strong, nonatomic) UIWindow *window;

 @end
 #import "AppDelegate.h"
#import "RootViewController.h"
@interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor]; self.window.rootViewController = [[RootViewController alloc] init]; [self.window makeKeyAndVisible];
return YES;
} @end
 #import <UIKit/UIKit.h>

 @interface RootViewController : UIViewController

 @end
 #import "RootViewController.h"
#import <MapKit/MapKit.h>
#import "YXYCAnation.h"
@interface RootViewController ()<MKMapViewDelegate> @end @implementation RootViewController - (void)viewDidLoad {
[super viewDidLoad];
// 初始化MKMapView
MKMapView *mapView = [[MKMapView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// 设置代理
mapView.delegate = self;
// 设置显示当前位置
mapView.showsUserLocation = YES;
// 设置地图显示类型
mapView.mapType = MKMapTypeStandard;
// 经纬度
CLLocationCoordinate2D coord2D = {23.117000,113.27500};
// 显示范围精度
MKCoordinateSpan span = {0.01,0.01};
// 显示区域
MKCoordinateRegion region = {coord2D,span};
// 给地图设置显示区域
[mapView setRegion:region animated:YES];
[self.view addSubview:mapView]; // 创建anation对象
CLLocationCoordinate2D showCoord = {23.117000,113.27500};
YXYCAnation *anation1 = [[YXYCAnation alloc] initWithCoordinate2D:showCoord];
anation1.title = @"越秀公园";
anation1.subtitle = @"小标题";
[mapView addAnnotation:anation1];
} #pragma mark -MKAnnotationView delegate-
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
static NSString *identifier = @"Annotion";
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
if (annotationView == nil) {
annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotationView reuseIdentifier:identifier];
annotationView.image = [UIImage imageNamed:@""];
}
return annotationView;
} - (void)buttonAction:(UIButton *)sender
{
NSLog(@"显示公园简介");
} @end
 #import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@interface YXYCAnation : NSObject<MKAnnotation> @property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle; - (id)initWithCoordinate2D:(CLLocationCoordinate2D)coordinate; @end
 #import "YXYCAnation.h"

 @implementation YXYCAnation

 - (id)initWithCoordinate2D:(CLLocationCoordinate2D)coordinate
{
self = [super init];
if (self != nil) {
_coordinate = coordinate;
}
return self;
} @end

iOS  地图(自定义地位图标)的更多相关文章

  1. CSS学习笔记----CSS3自定义字体图标

    响应式网页字体图标 作者:大漠 日期:2014-01-28 点击:3220 @font-face Responsive 本文由大漠根据Jason的<Responsive Webfont Icon ...

  2. Android高德地图自定义Markers的例子

    下文为各位重点介绍关于Android高德地图自定义Markers的例子,希望这篇文章能够让各位理解到Android高德地图自定义Markers的方法. 之前的博客里说了地图的嵌入和定位,今天就说说在地 ...

  3. 【高德API】如何利用MapKit开发全英文检索的iOS地图

    原文:[高德API]如何利用MapKit开发全英文检索的iOS地图 制作全英文地图的展示并不困难,但是要制作全英文的数据检索列表,全英文的信息窗口,你就没办法了吧.告诉你,我有妙招!使用iOS自带的M ...

  4. 百度地图自定义icon,定位偏移问题

    最近使用百度地图做一个调度系统,使用定义icon的marker,结果地图显示marker和实际位置偏移,最终参考文章: http://www.cnblogs.com/jz1108/archive/20 ...

  5. 【iOS地图开发】巧妙打造中英文全球地图

    地图开发的同学们经常遇到这样的问题,国内版地图开发,用高德或者百度就行了.但是,国外的地图怎么办?这里告诉大家,如果利用iOS地图,打造中英文的,国内国外都能用的,全球地图. 制作全英文地图的展示并不 ...

  6. 自定义iconfont 图标库下载本地在移动App的使用及svg彩色图标

    自定义iconfont 图标库扩展 在Hbuilder开发移动App的使用及svg彩色图标(或mui图标库的自定义扩展) 前提准备:1.登录阿里iconfont图标库,创建自己的项目,地址:http: ...

  7. 在项目中增加自定义icon图标

    以MUI框架为例,内容来自于MUI官网. mui如何增加自定义icon图标 mui框架遵循极简原则,在icon图标集上也是如此,mui仅集成了原生系统中最常用的图标:其次,mui中的图标并不是图片,而 ...

  8. iOS 如何自定义UISearchBar 中textField的高度

    iOS 如何自定义UISearchBar 中textField的高度 只需设置下边的方法就可以 [_searchBar setSearchFieldBackgroundImage:[UIImage i ...

  9. iOS 隐藏自定义tabbar

    iOS  隐藏自定义tabbar -(void)viewWillAppear:(BOOL)animated { NSArray *array=self.tabBarController.view.su ...

随机推荐

  1. Java 模拟ATM(修正)

    ATM机的账户记录Account有账户的唯一性标识(11个长度的字符和数字的组合),用户的姓名,操作日期(Date),操作类型,账户密码(六位的数字,可以用0开头),当前的余额(可以为0). 模拟AT ...

  2. Spring_总结_02_依赖注入

    一.前言 本文承接上一节:Spring_总结_01_Spring概述 在上一节中,我们了解了Spring的最根本使命.四大原则.六大模块以及Spring的生态. 这一节我们开始了解Spring的第二大 ...

  3. 3.20 内存及效率的一些总结 3.21 设置竖屏 3.22 CCLOG与CCLog区别

    3.20 内存及效率的一些总结 3.21 设置竖屏 1.android AndroidManifest.xml文件中, screenOrientation="landscape" ...

  4. 51nod 1685 第K大区间2

    定义一个长度为奇数的区间的值为其所包含的的元素的中位数.中位数_百度百科 现给出n个数,求将所有长度为奇数的区间的值排序后,第K大的值为多少. 样例解释: [l,r]表示区间的值[1]:3[2]:1[ ...

  5. spark流程跟踪

    每个action对应一个job,每个job里面会有很多个阶段(stage),其实每个stage都是一个算子(Operation),可能是transformation,可能是action:但是actio ...

  6. 第八篇 web开发学习资源

    互联网时代,最好的资源都在网上,好好利用网络学起来! 偶然才发现好资源,很多是E文的,看来努力的路还很长! 1)下面是一个老外收集的PHP资源,确实要为此分享点赞. https://github.co ...

  7. FPGA 竞争与冒险

    一,概念 在数字电路设计时,无论是组合.时序,还是FPGA电路中,都需要考虑竞争冒险现象(Race and Competition). 竞争:由于信号在传输和处理过程中经过不同的逻辑门.触发器或逻辑单 ...

  8. navicate笔记

    使用sql语句,在查询中写入sql语句,点击运行即可. 想让表清空,自增id从1开始,右键表选择删减表即可

  9. 增加 [确定] and [失败]系统提示

    增加 [确定] and  [失败]系统提示 #!/bin/bash. /etc/init.d/functionsaction "true" /bin/falseaction &qu ...

  10. 用反射封装HttpHandler,实现通过action方法名调用方法

    using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using Sy ...