首页 > 其他 > 详细

高德地图作业一

时间:2016-01-02 14:10:27      阅读:226      评论:0      收藏:0      [点我收藏+]

#pragma mark -添加选择工具条

/**

 *  定位用户位置的模式:

     MAUserTrackingModeNone              = 0,    // 不追踪用户的location更新

     MAUserTrackingModeFollow            = 1,    // 追踪用户的location更新

     MAUserTrackingModeFollowWithHeading = 2     // 追踪用户的locationheading更新

 

 */

- (void)initToolBar{

    

    

    UISegmentedControl *searchTypeSegCtl = [[UISegmentedControl alloc] initWithItems:

                                            [NSArray arrayWithObjects:

                                             @"默认",

                                             @"位置",

                                             @"多方位",

                                             nil]];

    searchTypeSegCtl.selectedSegmentIndex  = _mapView.userTrackingMode;

    searchTypeSegCtl.frame = CGRectMake(200, CGRectGetHeight(_mapView.bounds) - 40, 160, 30);

    [searchTypeSegCtl addTarget:self action:@selector(userTrackingModeType:) forControlEvents:UIControlEventValueChanged];

    

    

    [_mapView addSubview:searchTypeSegCtl];

}

 

主要,该方法要在viewDidLoad里面实现,再写下如下方法监听按钮变化

 

- (void)userTrackingModeType:(UISegmentedControl *)segmentedControl

{

    _mapView.userTrackingMode = (long)segmentedControl.selectedSegmentIndex;

    

    NSLog(@"_mapView.userTrackingMode:%ld",(long)_mapView.userTrackingMode);

    

}

 

完。

高德地图作业一

原文:http://www.cnblogs.com/vshiron/p/5094572.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!