uibezierpath

UIView shadow issue with orientation

我们两清 提交于 2019-12-12 10:05:30
问题 I have UiTableView within UiView . I want to set corner radius & shadow to UIView . I am using this code to give shadow with corner and its working fine. myView.backgroundColor = [UIColor clearColor]; [myView.layer setCornerRadius:10.0f]; [myView.layer setBorderColor:[UIColor lightGrayColor].CGColor]; [myView.layer setBorderWidth:1.0f]; [myView.layer setShadowColor:[UIColor blackColor].CGColor]; [myView.layer setShadowOpacity:0.8]; [myView.layer setShadowRadius:3.0]; [myView.layer

How to add a shadow to a view that's masked with a path

心不动则不痛 提交于 2019-12-12 06:52:28
问题 How do I add a shadow to a view that's masked with a path? layer has a mask property that you can set like this yourCustomView.layer.mask = somePath . But how do I add a shadow that's also masked to the layer.mask ? 回答1: I see this asked quite a bit and answers are all over the place, so I thought I would centralize a tad. Basically when you want to add a shadow to a view that's masked with a path, things get interesting. This is an extension I built that handles it all and is really easy to

CAShapeLayer circle not showing on iPhone 6, but its working on iPhone 5 with the same code

≡放荡痞女 提交于 2019-12-12 03:04:03
问题 i made a simple circle programatically with cashapelayer in custom uiview class like this: class UserProfileCircleAnimated: UIView { private lazy var leftPhotoArc: CAShapeLayer = { let leftPhotoArc = CAShapeLayer() leftPhotoArc.lineWidth = 6 leftPhotoArc.strokeColor = UIColor.rgb(red: 232, green: 72, blue: 85, alpha: 1).cgColor leftPhotoArc.fillColor = nil leftPhotoArc.path = UIBezierPath(arcCenter: CGPoint(x: 25, y: 25), radius: 25 , startAngle: 2 * CGFloat(M_PI), endAngle: 0, clockwise:

Smootly mooving a hole in UIImage?

元气小坏坏 提交于 2019-12-12 01:53:51
问题 I have a UIImageView displaing an image. This view's layer is masked with CAShapeLayer in order to create circular "hole" in the image. To create the hole I use UIBezierPath with .usesEvenOddFillRule = true . It works fine when static. But I need that hole to move with user finger. To do that I create new UIBezierPath with even-odd rule each time user moves their finger. On smaller phones with smaller images it looks OK but on iPhone 6 Plus it is choppy. Any ideas on how to make it smooth are

Parametric Expression of a Bezier Curve

拈花ヽ惹草 提交于 2019-12-12 01:44:09
问题 I have used the Parametric Expression of a Bezier Curve to locate a point along my curve and it's working as it should. The problem is I'm setting my t value as the percentage of the y axis and unfortunately (and obviously) it doesn't correlate because my curve is longer than my Y axis. So in this program if I set my Y Value to 75 I want to return the point on my line that sits at the Y value of 25 (the inverse because in iOS the (0, 0) sits at the top left instead of the bottom left as my

UIBezierPath to UIImage

送分小仙女□ 提交于 2019-12-12 00:00:03
问题 I need to draw a pie chart. I found a nice tutorial here http://mac-objective-c.blogspot.com/2009/04/drawing-pie-charts.html The example uses NSBezierPath, but I use UIBezierPath because I need the graphic in IOS. Is there a way to obtain that graphic in a UIImage so I can show it in a UIImageView? In this tutorial http://blog.gafmediastudio.com/2010/07/02/draw-a-pie-chart-with-iphone-ipod-ipad/ they use CGContext and in the end they have a function that returns a UIImage. The UIBezierPath

UIBezierPath Array rendering issue (How to use CGLayerRef for optimization)

只愿长相守 提交于 2019-12-11 18:49:36
问题 friends, I am working with UIBezierPaths, for free hand drawing , and everything works fine, for this I am storing my paths in a path array, everything works fine, while rendering, I am looping the whole array and rendering the paths,but soon as the array count increases, I see a lag while drawing, below is my drawRect code. please help me out in finding where I am going wrong - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *mytouch=[[touches allObjects]

Add multiple mask to CALayer (1 is for adding corner)

蓝咒 提交于 2019-12-11 17:32:11
问题 I want to make UI like this I want this view have rounded corner and shadow on it. Here is my View hierarchy in Xib: -Content View - Shadow View - Container View - Left View - Concave View - Action View Here is my snippet to achieve the current UI: for concaving path: let couponPath = UIBezierPath() let zeroPoint = CGPoint.zero couponPath.move(to: zeroPoint) couponPath.addLine(to: CGPoint(x: leftView.frame.width, y: zeroPoint.y)) let radius = concaveView.frame.width / 2 let centerX =

How to find out uncoloured area uibeizerpath?

人走茶凉 提交于 2019-12-11 12:46:26
问题 That greycolour is UIImageView and the White colour font is Image. That image Placed inside UIImageView. I like to colour only inside the font ,not an whole UIImageview for that i am going to find out the coordinates of the image . i am new to this kind of concept so kindly some one guide me how to colour only inside the image ,there are 50+ images is there ,it is not static so give some good idea . This is the code i am using to draw inside the UIImageView: -(void)touchesMoved:(NSSet<UITouch

EXC_BAD_ACCESS while using CoreAnimation

依然范特西╮ 提交于 2019-12-11 11:54:10
问题 I use CoreAnimation to animate UIImageView (curve Bezier animation). Here`s my code: CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; pathAnimation.calculationMode = kCAAnimationCubic; pathAnimation.fillMode = kCAFillModeForwards; pathAnimation.removedOnCompletion = NO; CGPoint endPoint = originalPosition; UIBezierPath *path = [UIBezierPath bezierPath]; [path moveToPoint:star.layer.position]; [path addQuadCurveToPoint:endPoint controlPoint