1. <legend id='T7wUi'><style id='T7wUi'><dir id='T7wUi'><q id='T7wUi'></q></dir></style></legend>

      <tfoot id='T7wUi'></tfoot>

      <small id='T7wUi'></small><noframes id='T7wUi'>

    2. <i id='T7wUi'><tr id='T7wUi'><dt id='T7wUi'><q id='T7wUi'><span id='T7wUi'><b id='T7wUi'><form id='T7wUi'><ins id='T7wUi'></ins><ul id='T7wUi'></ul><sub id='T7wUi'></sub></form><legend id='T7wUi'></legend><bdo id='T7wUi'><pre id='T7wUi'><center id='T7wUi'></center></pre></bdo></b><th id='T7wUi'></th></span></q></dt></tr></i><div id='T7wUi'><tfoot id='T7wUi'></tfoot><dl id='T7wUi'><fieldset id='T7wUi'></fieldset></dl></div>
        <bdo id='T7wUi'></bdo><ul id='T7wUi'></ul>

        MKOverlay 无法顺利调整大小

        时间:2023-10-03
          <bdo id='DvyEz'></bdo><ul id='DvyEz'></ul>

              <tbody id='DvyEz'></tbody>

            <legend id='DvyEz'><style id='DvyEz'><dir id='DvyEz'><q id='DvyEz'></q></dir></style></legend>

              <small id='DvyEz'></small><noframes id='DvyEz'>

            • <i id='DvyEz'><tr id='DvyEz'><dt id='DvyEz'><q id='DvyEz'><span id='DvyEz'><b id='DvyEz'><form id='DvyEz'><ins id='DvyEz'></ins><ul id='DvyEz'></ul><sub id='DvyEz'></sub></form><legend id='DvyEz'></legend><bdo id='DvyEz'><pre id='DvyEz'><center id='DvyEz'></center></pre></bdo></b><th id='DvyEz'></th></span></q></dt></tr></i><div id='DvyEz'><tfoot id='DvyEz'></tfoot><dl id='DvyEz'><fieldset id='DvyEz'></fieldset></dl></div>
              • <tfoot id='DvyEz'></tfoot>
                  本文介绍了MKOverlay 无法顺利调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已将 MKCircle 作为 MKOverlay 添加到我的 MKMapView.我还添加了一个 UISlider 来决定圆的半径.不幸的是,当使用它时,它似乎有点滞后",不像我想要的那样流畅.

                  I have added a MKCircle as MKOverlay to my MKMapView. Also I added an UISlider to decide the radius of the circle. Unfortunately when using this it seems a bit "laggy", not smootly like I want it to be.

                  示例:http://dl.dropbox.com/u/3077127/mkoverlayDelay.mov

                  这是我的代码:

                  - (void)addCircle
                  {
                      // draw the radius circle for the marker
                      double radius = 2000.0;
                      MKCircle *circle = [MKCircle circleWithCenterCoordinate:location radius:radius];
                      [circle setTitle:@"background"];
                      [mapView addOverlay:circle];
                  
                      MKCircle *circleLine = [MKCircle circleWithCenterCoordinate:location radius:radius];
                      [circleLine setTitle:@"line"];
                      [mapView addOverlay:circleLine];
                  }
                  
                  - (void)addCircleWithRadius:(double)radius
                  {
                      MKCircle *circle = [MKCircle circleWithCenterCoordinate:location radius:radius];
                      [circle setTitle:@"background"];
                      [mapView addOverlay:circle];
                  
                      MKCircle *circleLine = [MKCircle circleWithCenterCoordinate:location radius:radius];
                      [circleLine setTitle:@"line"];
                      [mapView addOverlay:circleLine];
                  }
                  
                  - (void)sliderChanged:(UISlider*)sender
                  {
                      [mapView removeOverlays:[mapView overlays]];
                  
                      double radius = (sender.value * 100);
                  
                      [self addCircleWithRadius:radius];
                  }
                  
                  - (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay{
                      MKCircle *circle = overlay;
                      MKCircleView *circleView = [[[MKCircleView alloc] initWithCircle:overlay] autorelease];
                  
                      if ([circle.title isEqualToString:@"background"])
                      {
                          circleView.fillColor = UIColorFromRGB(0x598DD3);
                          circleView.alpha = 0.25;
                      }
                      else
                      {
                          circleView.strokeColor = UIColorFromRGB(0x5C8AC7);
                          circleView.lineWidth = 2.0;
                      }
                  
                      return circleView;
                  }
                  

                  有没有人对我如何解决这个问题有任何建议?

                  Does anybody have any suggestions on how I can smoothen this?

                  最好的问候,
                  保罗·皮伦

                  Best regards,
                  Paul Peelen

                  推荐答案

                  我已经尝试过你的代码,并找到了一个非常简单的方法来使它更流畅.

                  I have tried your code and found a very easy way to make it smoother.

                  如果更改调用顺序:- (void)sliderChanged:(UISlider*)sender

                  你可以调用[self addCircleWithRadius:radius];

                  调用之前[mapView removeOverlays:[mapView overlays]];

                  只要确保不要删除刚刚添加的叠加层,只删除旧的.

                  Just make sure you dont remove the overlays you just added, only the old ones.

                  这将使您的大小调整更平滑,特别是当新圆比旧圆小时.

                  This will give you a smoother resizing, specially when the new circle is smaller than the old one.

                  对于更大的圆圈,您最好使用 NSOperations 以确保更快地创建视图,这将使其更平滑.

                  For circles that are bigger you are probably better off using NSOperations to ensure the views are created faster, this will make it smoother.

                  希望这会有所帮助.

                  这篇关于MKOverlay 无法顺利调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:获取 URL 字符串的域部分? 下一篇:使用 Image Magick 对 iPhone 中的图像进行边缘检测

                  相关文章

                1. <tfoot id='2cTvr'></tfoot>
                  <legend id='2cTvr'><style id='2cTvr'><dir id='2cTvr'><q id='2cTvr'></q></dir></style></legend>
                    <bdo id='2cTvr'></bdo><ul id='2cTvr'></ul>

                    <i id='2cTvr'><tr id='2cTvr'><dt id='2cTvr'><q id='2cTvr'><span id='2cTvr'><b id='2cTvr'><form id='2cTvr'><ins id='2cTvr'></ins><ul id='2cTvr'></ul><sub id='2cTvr'></sub></form><legend id='2cTvr'></legend><bdo id='2cTvr'><pre id='2cTvr'><center id='2cTvr'></center></pre></bdo></b><th id='2cTvr'></th></span></q></dt></tr></i><div id='2cTvr'><tfoot id='2cTvr'></tfoot><dl id='2cTvr'><fieldset id='2cTvr'></fieldset></dl></div>

                    1. <small id='2cTvr'></small><noframes id='2cTvr'>