Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jagatnibas

macrumors regular
Original poster
Jul 28, 2008
126
0
i worked last in mapkit 2 year back, hence a little rusty.

i have checked show current location in my mapview, it shows the current location pin at a usa location, i guess cupurtino, but it is not centered. but the MKCoordinateRegion center lat long and mapview center lat long are same.

i also noticed another thing, that i cannot go further left when i drag left beyond north america, means the map seems to be flat, i thought it would be round and i can drag rounded as many times as i want, please suggest.

also i am asked to make my current location centered in the map and zoom level to 5 miles, how would i do that ?

thanks in advance
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
This is all explained really well on some tutorials online though..
What you need is an zoom on your map..
Code:
    [self.mapView setRegion: MKCoordinateRegionMakeWithDistance(CLLocationCoordinate2DMake(self.eventAnnotation.coordinate.latitude,self.eventAnnotation.coordinate.longitude), 200, 200) animated:YES];

this is showing yourself pin his lati/longi, and zooms with it animated to the box of 200,200, whatever fits your needs :)
 

jagatnibas

macrumors regular
Original poster
Jul 28, 2008
126
0
thanks a lot for the help, but why is not the current location centered ?
 

jagatnibas

macrumors regular
Original poster
Jul 28, 2008
126
0
please see the attached screen shot, the current location is in the left side where as i want it centered and total iphone screen set to 5 miles, rest user should drag and see. i have not added any code for setregion and setcenter as yet, only i have checked show current location in nib file.
 

Attachments

  • map.tiff.zip
    55.6 KB · Views: 62

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
For those of you not wanting to download a file and unzip it to look at a simple screenshot:
 

Attachments

  • map.png
    map.png
    58.1 KB · Views: 118

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
Oh my, not even custom pins :( hurts ma eyes!

And you are showing your own location via the normal Mapkit usage of your location. I have no experience on that, what I do, is look for my location via CLLocationManager, and put a pin on my map with my location. and center that..
Hopefully someone else will set you on their way.
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
the current location is in the left side where as i want it centered and total iphone screen set to 5 miles, rest user should drag and see. i have not added any code for setregion and setcenter as yet, only i have checked show current location in nib file.
So, what are you asking? Are you wondering why the mapView doesn't automatically get centered on the user's location (it doesn't)? Or are you asking for the code to do that centering?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.