Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. - (IBAction)pinch:(UIPinchGestureRecognizer *)sender{
  2.  
  3. CGFloat scale =[(UIPinchGestureRecognizer *)sender scale];
  4. float searchRadius=(float)scale;
  5. if(searchRadius*5<=4.99)
  6. {
  7.  
  8. for (CALayer *layer in self.view1.layer.sublayers) {
  9. [layer removeFromSuperlayer];
  10. }
  11.  
  12.  
  13. CAShapeLayer *circleLayer = [CAShapeLayer layer];
  14.  
  15. [circleLayer setBounds:CGRectMake(0.0f-2, 0.0f, [self.view1 bounds].size.width+3,
  16. [self.view1 bounds].size.height)];
  17. [circleLayer setPosition:CGPointMake(CGRectGetMidX([self.view1 bounds]),CGRectGetMidY([self.view1 bounds]))];
  18.  
  19.  
  20. UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, CGRectGetWidth(self.view1.frame)*scale, CGRectGetHeight(self.view1.frame)*scale)];
  21.  
  22.  
  23. [circleLayer setPath:[path CGPath]];
  24.  
  25.  
  26. searchRadius=searchRadius*5;
  27. NSMutableString *searchRadiusStr=[NSMutableString stringWithFormat:@"%.02f", searchRadius];
  28. [searchRadiusStr appendString:@" mi"];
  29. _searchRadiusLbl.text=searchRadiusStr;
  30.  
  31. [circleLayer setStrokeColor:[[UIColor colorWithRed:88/255.0 green:193/255.0 blue:130/255.0 alpha:1.0] CGColor]];
  32.  
  33. [circleLayer setLineWidth:1.0f];
  34.  
  35.  
  36.  
  37. [circleLayer setFillColor:[[UIColor colorWithRed:47/255.0 green:222/255.0 blue:117/255.0 alpha:0.2] CGColor]];
  38.  
  39. circleLayer.masksToBounds=YES;
  40.  
  41.  
  42. [[self.view1 layer] addSublayer:circleLayer];
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement