Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 507

Gledy
Aspiring developer
Profile
Posts: 109
Reg: Feb 25, 2013
Fleet, UK
3,240
02/07/24 12:09 PM (9 months ago)

Location map Zoom

Hi, I've looked on previous forums and in Xcode but haven't found the right way to do it yet, I have set x amount of pins on a location map plugin, on certain ones the pins might be a little further away so when loading up the page on a device it can either not display any pins as the centre distance is too far or only show a couple of the pins. Basically I want to change the code so the initial zoom/center is of a larger distance so all pins show up. If anyone knows the answer, I'd appreciate it.
 
Cakebit
Code is Art
Profile
Posts: 501
Reg: Dec 15, 2010
In your local b...
16,510
like
02/09/24 12:18 AM (9 months ago)
Hi Gledy! In BT_Screens > bt_screen_map > BT_screen_map.m there is a section that is supposed to handle this automatically by scaling out to show all pins (lines 514 – 525)... but it looks like it's not been adjusted for the larger iPhone sizes. I'd recommend playing with the numbers to see if you can scale it to your map coordinates. Just adjust the multiplication numbers to scale or de-scale (is that a word?) until you get all your pins to show on the map at once. :) Cheers!
 
Gledy
Aspiring developer
Profile
Posts: 109
Reg: Feb 25, 2013
Fleet, UK
3,240
like
02/09/24 08:39 AM (9 months ago)
Hi Cakebit, I spent a lot of time yesterday messing around with loads of code and nothing helped, best I got it to do was zoom in even more to street level. I wanted to start again, so downloaded the project and moved the unedited bt_screen_map folder into my project.........and wouldn't you know it, without changing any code all the pins would appear on the screen. If that was just a fluke I'll try the scale or de-scale approach ;) Thanks pal
 
Gledy
Aspiring developer
Profile
Posts: 109
Reg: Feb 25, 2013
Fleet, UK
3,240
like
02/14/24 07:04 AM (9 months ago)
Ok so weird one, after an "un-edited" copy of the code it works as should do, but after a few tests of the page it will revert back to not showing all the pins. If you force close the app down on a live device and relaunch, it will go back to working as should for a bit. I've decided to just change the scale valves a couple of times and the best outcome for all maps so far is: if(UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation)){ region.center.latitude = topLeftCoord.latitude - (topLeftCoord.latitude - bottomRightCoord.latitude) * 0.5; region.center.longitude = topLeftCoord.longitude + (bottomRightCoord.longitude - topLeftCoord.longitude) * 0.5; region.span.latitudeDelta = fabs(topLeftCoord.latitude - bottomRightCoord.latitude) * 1.1; region.span.longitudeDelta = fabs(bottomRightCoord.longitude - topLeftCoord.longitude) * 1.1; }else{ region.center.latitude = topLeftCoord.latitude - (topLeftCoord.latitude - bottomRightCoord.latitude) * 0.5; region.center.longitude = topLeftCoord.longitude + (bottomRightCoord.longitude - topLeftCoord.longitude) * 0.5; region.span.latitudeDelta = fabs(topLeftCoord.latitude - bottomRightCoord.latitude) * 1.3; region.span.longitudeDelta = fabs(bottomRightCoord.longitude - topLeftCoord.longitude) * 1.3; } And all seems to be fine.
 

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.