Discussion Forums  >  Maps, Device Location, Tracking

Replies: 4    Views: 313

GilbertAZ
Aspiring developer
Profile
Posts: 37
Reg: Jul 16, 2012
Arizona
2,820
11/09/12 05:51 PM (11 years ago)

Show callout bubble at default (onload)

I have a map with multiple pin locations. Is there anyway I can show the callout bubble on a specific location at default. I know a tap shows the callout bubble, but I want it to display when the map loads, not onTap. There's not an option in the control panel, maybe this is a field I can pass using the Screen Data URL? Or I gotta dig into xCode? Thanks!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/10/12 12:46 AM (11 years ago)
This is for sure and Xcode thing. Not hard to do if you understand "which" location you want to show. At least in theory :-) The iOS map kit has a method called: selectAnnotation You should be able to trigger this method (like tapping a pin yourself) after all the locations are placed on the map. "Drop the pins, show this callout bubble." Your method call will look like: [self.mapView selectAnnotation:[self.mapView.annotations objectAtIndex:4] animated:TRUE]; Notice the 4 in that method call, that's showing the 4th annotation in the list. You'll need to experiment with the data to figure out which item index you want to show. And, this won't be easy to change after you compile the app. The next question is "when" do you trigger the method? You'll want to place this on about line 439 in the BT_screen_map.m file. Just below this line: [self.mapView setRegion:region animated:YES]; Lastly, if you need to do this dynamically, you can. But, you'll need a way to introduce a new property in the JSON data. This property would be something like "default selected" or something. This means you'll need to create your own data file (the JSON) to power the map so you can customize the format of the JSON. Then, you'll need to "figure out" which index to highlight after the map loads. Doable, yes. Tough, for most people :-) Good luck.
 
GilbertAZ
Aspiring developer
Profile
Posts: 37
Reg: Jul 16, 2012
Arizona
2,820
like
11/10/12 09:00 AM (11 years ago)
Thanks David! I think I'll try to go dynamic with this. I'll setup a PHP page and pass the location, foo.php?location=4&BTAppID=1234 etc.. Then create some JSON w/ new property "annotate": "<?php echo $location; //4 ?>" I'll edit Xcode accordingly to read in the JSON and new property field. I better go start the coffee. :-) Thank you for your suggestion and leads!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/11/12 02:06 AM (11 years ago)
"all go dynamic" - YES! I'm smiling because this statement suggests you've got a good grip on much of this. Cool. Hollar if you can't get it to work as you expect. iOS 6 and the new maps is causing some freaky-ness of lots of folks. Sigh.
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
12/20/12 06:26 AM (11 years ago)
Hi David and Alzooka, First of all I'd really like to thank you David for your support and persistence! Buzztouch has really opened my horizons :). And seeing you here in the forums shows your responsibility and the love you have for the product. Not to mention how you believe in it. Anyway, I am having a problem with the maps plugin in iOS 6 which I thought I could use the line of code you sent here to fix it, but I was unsuccessful. Only in iOS 6 when the map screen loads up, I have my pin but no callout is showing at all by default. I do have a default callout from the pin at map load though in iOS 5. Any hints? Am I doing it right or should I call the method from here, and define it someplace else? (I put the folling line in the exact place you mentioned, but to no avail): //this line was already in the maps plugin file [self.mapView setRegion:region animated:YES]; //This is the line added. [self.mapView selectAnnotation:[self.mapView.annotations objectAtIndex:4] animated:TRUE];
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.