【发布时间】:2014-11-08 17:42:58
【问题描述】:
我有一个问题。我一直在查看堆栈溢出关于同一问题的其他答案,但我无法让它们为我工作。所以我要试着在这里问。我想要做的是当我在地图视图中并获得想要自动放大该位置的用户位置时。
h 文件
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>
@interface WalkingTableViewController: UIViewController <MKMapViewDelegate>
@property (weak, nonatomic) IBOutlet MKMapView *MKMapView;
@end
m 文件
#import "WalkingTableViewController.h"
@interface UITableViewController ()
@end
@implementation WalkingTableViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.MKMapView.showsUserLocation=YES;
self.MKMapView.delegate = self;
[self.MKMapView setUserTrackingMode:MKUserTrackingModeFollow animated:YES];
}
- (IBAction)StopButton:(id)sender
- (IBAction)StartButton:(id)sender
@end
【问题讨论】:
-
我想要的是它会像在 RunKeeper 应用程序中一样放大
-
你如何“拥有用户位置”?它是通过 CLLocationManager 定期进入,还是您存储了一个值并且您只需放大一次(即当手机移动时它不会改变)。
标签: ios objective-c mkmapview zooming