关于objective C:分段控制 | 珊瑚贝

Segmented Control


我想知道如何将 uiview 添加到标注右键,并且我已经编写了用于切换地图的段控制的代码,我不断收到一个断点,上面写着 MKMapView 选择段索引)无法识别的选择器。

你能帮忙吗。

代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(IBAction)setMap:(id)sender{

    switch (((UISegmentedControl *)sender).selectedSegmentIndex) {
        case 0:
            map.mapType = MKMapTypeStandard;
            break;

        case 1:
            map.mapType = MKMapTypeSatellite;
            break;

        case 2:
            map.mapType = MKMapTypeHybrid;
            break;

        default:
            break;
    }
}

  • 您使用 SegmentedControl 的方式没有任何问题(假设它是您已连接到该操作的 SegmentedControl)。请发布您用于地图的代码(我怀疑您所做的 map.mapType 分配无效)。


这表明 sender 不是 UISegmentedControl。添加以下内容以查看它是什么:

1
NSLog(@“Sender=%@”, NSStringFromClass([sender class]));


来源:https://www.codenong.com/11666480/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_9239.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?