freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內容

ios應用開發(fā)基礎教程-資料下載頁

2025-07-17 20:14本頁面
  

【正文】 協(xié)議也是無法包含進來的,因為這個協(xié)議也是屬于 MapKit框架中的,所以我們還要在頭文件中引入 MapKit頭文件。 71.import Foundation/ 72.import MapKit/ 73.@interface CustomAnnotation : NSObjectMKAnnotation 74.{ 75. CLLocationCoordinate2D coordinate。 76. NSString *title。 77. NSString *subtitle。 78.} (id)initWithCoordinate:(CLLocationCoordinate2D)coords。 80.@property (nonatomic, readonly) CLLocationCoordinate2D coordinate。 81.@property (nonatomic, copy) NSString *title。 82.@property (nonatomic, copy) NSString *subtitle。 83.@end 學習群: 262779381 同時我們還使用了 property語法,自勱生成 Getter和 Setter方法,但是因為coordinate屬性我們在定義的時候使用的 readonly,那么我們就無法對它生成 Getter方法,這就要求我們自己對 coordinate屬性迚行初始化操作。 84.import 85.@implementation CustomAnnotation 86.@synthesize coordinate,title,subtitle。 (id)initWithCoordinate:(CLLocationCoordinate2D)coords 88.{ 89. if (self = [super init]) { 90. coordinate = coords。 91. } 92. return self。 93.} 94.@end 學習群: 262779381 這樣我們就創(chuàng)建好了一個用于顯示大頭針信息的類,接下來我們就要在,并將實例顯示在地圖當中。 我們實現(xiàn)一個創(chuàng)建大頭針的方法。 (void)createAnnotationWithCoords:(CLLocationCoordinate2D)coords 96.{ 97. CLLocationCoordinate2D Coords = CLLocationCoordinate2DMake(,)。 98. CustomAnnotation *Annotation = [[CustomAnnotation alloc]initWithCoordinate:Coords]。 99. = @故宮博物院 。 100. = @The Palace Museum。 101. [mapView addAnnotation:Annotation]。 102.} 學習群: 262779381 首先我們還是要定義一個坐標點,用于插入大頭針,然后創(chuàng)建并初始化一個大頭針實例,并將開始創(chuàng)建的坐標信息作為大頭針的坐標,添加相應的標題和副標題,最后將大頭針信息添加到地圖中。 在 viewDidLoad方法中調用我們的創(chuàng)建大頭針方法,就可將大頭針顯示在地圖中。因為我們是創(chuàng)建一個特定坐標位置的大頭針信息,所以我們需要將上節(jié)例子中的定位系統(tǒng)關閉, [locationManager startUpdatingLocation]。刪除這行代碼。 (void)viewDidLoad 104.{ 105. ………… 106. [mapView setRegion:[mapView regionThatFits:region]animated:YES]。 107. [ addSubview:mapView]。 108. [self createAnnotationWithCoords:coords]。 109.} 學習群: 262779381 學習群: 262779381 本章通過講解 MKMapView與 MKAnnotation講解了 IOS中地圖位置的編程方法。 學習群: 262779381 本章小結 課后習題 ,實現(xiàn)即時定位功能,當手持手機走動時,能夠即時獲得設備的位置,并顯示在地圖上。 ,增加大頭針,用于標注設備位置改變的情況。 學習群: 262779381
點擊復制文檔內容
公司管理相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1