Is the Current Location/Compass heading button available in the iOS sdk?

后端 未结 2 1367
名媛妹妹
名媛妹妹 2020-12-08 12:03

I am working on a sample map kit app for iOS. I have everything working and a toolbar button to toggle the MKUserTrackingMode. This may seem like a silly question but I have

相关标签:
2条回答
  • 2020-12-08 12:23

    Maybe I am misunderstanding your question but it sounds like you want to be setting the userTrackingMode property of your MKMapView to theMKUserTrackingMode.MKUserTrackingModeFollowWithHeading.

    0 讨论(0)
  • 2020-12-08 12:28

    You need to create a MKUserTrackingBarButtonItem and pass it the MKMapview in the constructor, then add that button item to the navigation menu (or where ever it is your button should be).

    - (void)viewDidLoad
    {
        [super viewDidLoad];    
        MKUserTrackingBarButtonItem *buttonItem = [[MKUserTrackingBarButtonItem alloc] initWithMapView:self.map];
        self.navigationItem.rightBarButtonItem = buttonItem;
    }
    
    0 讨论(0)
提交回复
热议问题