Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8229301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:45:12+00:00 2026-06-07T16:45:12+00:00

I have the map currently working when the user click on the buttons. How

  • 0

I have the map currently working when the user click on the buttons.

How can I zoom into the map and possibly animate as it xooms in, when the user click on the buttons.

Here are hte main files and the header files. Also, how can i show my current location?

Thanks in advance
main file

@synthesize map;


//Add Map overlay

-(MKOverlayView*)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay{



    MKCircleView* circleView =[[MKCircleView alloc] initWithOverlay:overlay];

    circleView.strokeColor = [UIColor blueColor];

    circleView.fillColor = [UIColor redColor];

    return circleView;



}


-(IBAction)onLocationButtonTop:(id)sender {





    UIBarButtonItem* b = (UIBarButtonItem*) sender;

    int tag = b.tag;



    float latitude = 40.0;

    float longitude  = -75.0;



    if(tag == 1){

        latitude = 57.15;longitude  = -2.15;

    }

    else if(tag == 2){

        latitude = 39.91;longitude  = 116.41;

    }

    else{

        latitude = -1.46;longitude  = -48.48;

    }



    CLLocationCoordinate2D x;

    x.latitude = latitude;

    x.longitude = longitude;









    MKCoordinateSpan z;

    z.latitudeDelta = 0.25;

    z.longitudeDelta = 0.25;



    MKCoordinateRegion y;

    y.center = x;

    y.span = z;



    map.region = y;

    [map addOverlay:[MKCircle circleWithCenterCoordinate:x

                                                 radius:1000]];



}

h file

#import <UIKit/UIKit.h>

#import <MapKit/MapKit.h>


@interface MapExampleK2ViewController : UIViewController <MKMapViewDelegate>



@property (strong,nonatomic) IBOutlet MKMapView* map;


-(IBAction)onLocationButtonTop:(id)sender;



@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:45:15+00:00Added an answer on June 7, 2026 at 4:45 pm

    For second part of your question You can use CLLocationManager to get you current location and then use setRegion when the location updates. You can refer to region code posted on http://developer.apple.com/library/ios/#samplecode/Regions/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010726.

    Below is the function from that code that is setting focus on the map to your current location.

    - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
        NSLog(@"didUpdateToLocation %@ from %@", newLocation, oldLocation);
        
            if (oldLocation == nil) {
            // Zoom to the current user location.
            MKCoordinateRegion userLocation = MKCoordinateRegionMakeWithDistance(newLocation.coordinate, 1500.0, 1500.0);
            [regionsMapView setRegion:userLocation animated:YES];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to combine Underscore's filter and map? I currently have two separate
I have a map of the UK broken down into various geographic regions. I
I'm currently working on an Android application. I wish to have a GridView on
For the project I'm currently working on I have a database with locations (restaurants,
I'm currently working on adding memcache to an app running on GAE/J. I have
i have problem with my map. Map was working correctly about 5 months ago.
Morning Everyone!.. General Routing Quesiton Here... I'm currently working to achieve a route similar
I have the following problem using subversion: I'm currently working on the trunk of
I am currently working on google map api V3 using cakephp with prototype.js. I
I'm currently working on a project that requires that I have a div stacked

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.