使用滑块放大WKInterfaceMap(WKInterfaceSlider)

时间:2016-01-20 11:59:16

标签: ios objective-c iphone zoom watchkit

我的地图上有一个滑块,我试图通过滑块放大。下面是我正在使用的代码,当点击+或 - 时,地图只显示蓝色(水)

server {
    listen 80 default_server;

    set $mobile "false";

    if ($http_user_agent ~* '(phone|droid)') {
        set $mobile "true";
    }

    if ($mobile = true) {
        return 301 http://X.X.X.X/mobile$request_uri;
    }

    location /mobile {
        include uwsgi_params;
        uwsgi_pass unix:/var/www/video_m/video.sock;
    }

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/var/www/video/video.sock;
    }
}

1 个答案:

答案 0 :(得分:0)

您可能在错误的地方传递纬度和经度值。 尝试这个,应该工作

- (IBAction)sliderAction:(UISlider*)slider
{
    CGFloat value = slider.value; // slider.maximumValue - slider.value // if you want reverse effect
    CGFloat sliderMax = slider.maximumValue;
    CGFloat zoom = value / sliderMax;
    RestaurantObject *restaurant = [nearbyMapArray objectAtIndex:0];
    CLLocationCoordinate2D mapLocation = CLLocationCoordinate2DMake([restaurant.latitude doubleValue], [restaurant.longitude doubleValue]);
    MKCoordinateSpan coordinateSpan = MKCoordinateSpanMake(1*zoom, 1*zoom);
    [self.map setRegion:(MKCoordinateRegionMake(mapLocation, coordinateSpan))];
}