How to use Ios_sn_ maps (3)

Source: Internet
Author: User
<span id="Label3"></p><p><p>Map positioning, Remember not to locate the time to turn off the positioning or will always be positioned to make the power use too fast.</p></p><pre class="brush:csharp;gutter:true;">-(void) viewdidload {[super viewdidload]; Do any additional setup after loading the VIEW. Self.mapview = [[bmkmapview alloc] initwithframe:cgrectmake (0, 0, kwidth, kheigth)]; [self.mapview setzoomlevel:14]; [self.view addSubview:self.mapView]; Initialize Bmklocationservice _locservice = [[bmklocationservice alloc]init]; _locservice.delegate = self; Start Locationservice [_locservice startuserlocationservice];} Implementation of relevant delegate processing location information update//processing direction change Information-(void) didupdateuserheading: (bmkuserlocation *) userlocation{//nslog (@ "heading is %@ ", userlocation.heading); NSLog (@ "%@--%@--%f--%f", userlocation.title,userlocation.subtitle,userlocation.location.altitude, userLocation.location.altitude); }//processing location coordinates update-(void) didupdatebmkuserlocation: (bmkuserlocation *) userlocation{_mapview.showsuserlocation = yes;//display fixed Bitmap Layer [_mapview updatelocationdata:userlocation]; NSLog (@ "didupdateuserlocation lat%f,long%f", UserLocation.location.coordinate.latitude,userlocation.location.coordinate.longitude);} </pre><p><p>Custom pins, to customize the PIN model first, The core code is as Follows:</p></p><pre class="brush:csharp;gutter:true;"><pre class="brush:csharp;gutter:true;">-(bmkannotationview *) mapview: (bmkmapview *) view viewforannotation: (id <BMKAnnotation>) annotation{ static NSString *annotationviewid = @ "annotationviewid"; Mypointannotation *myannotation = (mypointannotation *) annotation; Myannotationview *annotationview = (myannotationview *) [view dequeuereusableannotationviewwithidentifier: annotationviewid]; if (annotationview = = Nil) { annotationview = [[myannotationview alloc] initwithframe:cgrectmake (0, 0, +) VI Ewforannotation:myannotation reuseidentifier:annotationviewid]; Annotationview.image = [UIImage imagenamed:@ "positioning. png"]; } else { annotationview.myannotation = myannotation; [annotationview setneedslayout]; } Annotationview.annotation = myannotation; Annotationview.canshowcallout = true; Return annotationview;}</pre></pre><p><p>Here is a whole demo will be Posted.</p></p><p><p></p></p><p><p>How to use Ios_sn_ maps (3)</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.