我有要求我必須在CLLocationManager中繪製區域的圓。我已經完成了要求與本準則的,如何在半徑增加時在CLLocationManager中繪製區域的固定圓圈
CLLocationDegrees latitude = 37.33492222;
CLLocationDegrees longitude = -122.03304215;
CLLocationCoordinate2D centerPoint = CLLocationCoordinate2DMake(latitude, longitude);
CLLocationDistance radius = 100.0;
CLRegion *region = [[CLRegion alloc]initCircularRegionWithCenter:centerPoint radius:radius identifier:@"Apple"];
[locationManager startMonitoringForRegion:region];
CAShapeLayer *circle = [CAShapeLayer layer];
circle.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 2.0*radius, 2.0*radius)
cornerRadius:radius].CGPath;
// Center the shape in self.view
circle.position = CGPointMake(CGRectGetMidX(self.view.frame)-radius,
CGRectGetMidY(self.view.frame)-radius);
// Configure the apperence of the circle
circle.fillColor = [UIColor clearColor].CGColor;
circle.strokeColor = [UIColor redColor].CGColor;
circle.lineWidth = 1;
circle.opacity = 0.5;
// Add to parent layer
[self.view.layer addSublayer:circle;
我已經離開了把作爲
問題是當我給出的半徑值是100,我得到的結果是屏幕截圖。如果我將價值定爲200,那麼顯然這個圓圈會增加。
我的問題是,我想圓在相同大小在任何給定數值比如200,300或400。
lol @ rajesh.k ..你可以硬編碼在半徑100 .. –
圓將增加。下一行你說圓相同的大小..我不能unserstand :( – Rushabh
當我增加半徑它增加了circle.but我不想增加,我想循環爲靜態。 –