barndog
barndog

Reputation: 7163

Control Zoom Time on ios MapView

The MKMapKit zoom animation is great and all but it always takes a predefined moment of time to complete the action, that is to say, I as a programmer, have no way of setting a custom time for it to zoom into a particular location.

I've tried throwing the setRegion function inside animation blocks but that doesn't work, the zoom just takes the same amount of time either way. How do you set a custom zoom time?

Upvotes: 0

Views: 93

Answers (1)

iProgrammed
iProgrammed

Reputation: 980

The solution to your Problem is Nstimer

ViewController.h

#import <UIKit/UIKit.h>

@interface NSTimerExampleViewController : UIViewController {
    NSTimer *aTimer;
}

@end

ViewController.m

#import "NSTimerExampleViewController.h"

    @implementation NSTimerExampleViewController

    -(void)timerFired:(NSTimer *) theTimer
    {    
        NSLog(@"timerFired @ %@", [theTimer fireDate]);
    }

    - (void)viewDidLoad {
        [super viewDidLoad];
        //This starts the Timer
        aTimer = [NSTimer scheduledTimerWithTimeInterval:10.0
                                                  target:self 
                                                selector:@selector(timerFired:) 
                                                userInfo:nil 
                                                 repeats:YES];

    }

Upvotes: 1

Related Questions