Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (IBAction)pinch:(UIPinchGestureRecognizer *)sender{
- CGFloat scale =[(UIPinchGestureRecognizer *)sender scale];
- float searchRadius=(float)scale;
- if(searchRadius*5<=4.99)
- {
- for (CALayer *layer in self.view1.layer.sublayers) {
- [layer removeFromSuperlayer];
- }
- CAShapeLayer *circleLayer = [CAShapeLayer layer];
- [circleLayer setBounds:CGRectMake(0.0f-2, 0.0f, [self.view1 bounds].size.width+3,
- [self.view1 bounds].size.height)];
- [circleLayer setPosition:CGPointMake(CGRectGetMidX([self.view1 bounds]),CGRectGetMidY([self.view1 bounds]))];
- UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, CGRectGetWidth(self.view1.frame)*scale, CGRectGetHeight(self.view1.frame)*scale)];
- [circleLayer setPath:[path CGPath]];
- searchRadius=searchRadius*5;
- NSMutableString *searchRadiusStr=[NSMutableString stringWithFormat:@"%.02f", searchRadius];
- [searchRadiusStr appendString:@" mi"];
- _searchRadiusLbl.text=searchRadiusStr;
- [circleLayer setStrokeColor:[[UIColor colorWithRed:88/255.0 green:193/255.0 blue:130/255.0 alpha:1.0] CGColor]];
- [circleLayer setLineWidth:1.0f];
- [circleLayer setFillColor:[[UIColor colorWithRed:47/255.0 green:222/255.0 blue:117/255.0 alpha:0.2] CGColor]];
- circleLayer.masksToBounds=YES;
- [[self.view1 layer] addSublayer:circleLayer];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement