uibezierpath

Circle with fluid/strechy stroke

你。 提交于 2019-12-08 14:10:57
问题 Me and my team are working on an app for a client. We are trying to understand how to achieve this kind of animations ( refer only to the circle stroke ) : We tried using a CADisplayLink to set up and change the circle, but it generated non-fluid results. We couldn't find a way to create a circle from "components" of UIBezierPath and change each of the anchors. Any suggestions on how to achieve this kind of effect, or how to construct a circle from seperated points, would be highly appricated

What is the Best Way To show UITextField with only a bottom border?

蹲街弑〆低调 提交于 2019-12-08 12:32:27
I would like to have UITextField appear only with a bottom border. See the designer's image below: UIBezierPath *path = [UIBezierPath bezierPath]; [path moveToPoint:CGPointMake(150.0, 350.0)]; [path addLineToPoint:CGPointMake(250.0, 209.0)]; CAShapeLayer *shapeLayer = [CAShapeLayer layer]; shapeLayer.path = [path CGPath]; shapeLayer.strokeColor = [[UIColor blueColor] CGColor]; shapeLayer.lineWidth = 3.0; shapeLayer.fillColor = [[UIColor clearColor] CGColor]; I have Tried This but not Getting Appropriate Results. Any Suggestions ? 来源: https://stackoverflow.com/questions/25976119/what-is-the

SCNShape not drawing with UIBezierPath under certain circumstances

痴心易碎 提交于 2019-12-08 11:48:14
问题 I believe this may be an iOS bug, and I've reported it to Apple via Bug Report. I'll post it here in case there's some workaround I can use, or explanation of the cause. I'm wanting to draw the stroke of a UIBezierPath within SceneKit. I'm using the CGPath copyStrokingWithWidth function, and then creating a SCNShape using the given path. This works fine for lines with 2 points, but on lines with 3 points, the SCNShape doesn't display anything. I've determined that this is only the case when

UIBezierPath in NSDictionary - is it possible?

≡放荡痞女 提交于 2019-12-08 09:35:29
问题 I am trying to save a UIBezierPath and some other values in an NSDictionary. I write in the dictionary like this: NSMutableArray *paths = [[NSMutableArray alloc]init]; touchesBegan: - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { CGPoint touchPoint = [[touches anyObject] locationInView:self.drawImage]; path = [[UIBezierPath bezierPath] retain]; path.lineCapStyle = kCGLineCapRound; path.lineWidth = brushSize; [path moveToPoint:touchPoint]; [self updateDrawingBoard]; }

UIBezierPath : Incorrect retrieval of view screenshot

此生再无相见时 提交于 2019-12-08 07:44:43
问题 I'm taking the screenshot following way. - (UIImage*)screenshot { UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow]; CGRect rect = [keyWindow bounds]; UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); [keyWindow.layer renderInContext:context]; UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return img; } On UIView I'm drawing paths using UIBezierPath . The screenshots that I'm getting are

iOS - Fill bezierPath with multiple colors based on percentage

荒凉一梦 提交于 2019-12-08 04:55:24
I drawed a UIBezierPath in Objective-C and fill it with a red color. Now, I want to fill the path with multiple colors based on percentage. For example: I want to fill the path with 20% green color and the remaining 80% with red color, on top of each other (not a gradient). I also want a few pixels spacing between the fill and the stroke. I don't know how I can accomplish these things. Does anyone know how I can accomplish this or point me in the right direction? Many thanks in advance! UIBezierPath* bezierPath = UIBezierPath.bezierPath; [bezierPath moveToPoint: CGPointMake(50, 50)];

How to disable TouchUpInside Action outside the boundary of button

一笑奈何 提交于 2019-12-08 04:41:11
问题 This is my Xib. I just dragged a UIButton and changed its background color. I created a semi circle layer using this code let circlePath = UIBezierPath.init(arcCenter: CGPointMake(mybutton.bounds.size.width / 4, 0), radius: mybutton.bounds.size.height, startAngle: 0.0, endAngle: CGFloat(M_PI), clockwise: true) let circleShape = CAShapeLayer() circleShape.path = circlePath.CGPath mybutton.layer.mask = circleShape and this is my output. Its perfect as I want it. But the problem is that this

Drawing curved lines without lagging?

为君一笑 提交于 2019-12-08 04:28:25
问题 I have a class below that when attached to a view draws curved lines when the user touches their device. The problem is that the lines drawn seem to lag behind from the position of the finger on the screen. The lagging is enough to be noticeable and mildly annoying as new sections of the line display a small distance away from the finger touching the screen. The code uses the addCurveToPoint curve method. (The alternative addQuadCurveToPoint curve method appears to be less superior in terms

Drawing a partial circle

大兔子大兔子 提交于 2019-12-08 03:59:52
问题 I'm writing a program that will take a number between 0 and 1, and then spits out a circle (or arc I guess) that is completed by that much. So for example, if 0.5 was inputted, the program would output a semicircle if 0.1, the program would output a tiny little arc that would ultimately be 10% of the whole circle. I can get this to work by making the angle starting point 0, and the angle ending point 2*M_PI*decimalInput However, I need to have the starting point at the top of the circle, so

iOS利用 UIBezierPath 画五星红旗 五角星

旧城冷巷雨未停 提交于 2019-12-08 03:50:02
首先 ,别那么多废话 ,先来张图,成品 。。。 然后 , 我们来科普下国旗是怎么画的 。。。 https://www.douban.com/note/509127465/ 我们科普完之后 , 我们需要开始搞起了 。。。。 首先我们的国旗是 长宽比是 3:2 (不同的国家国旗比例不一样 ) 第一步:确定5颗五角星的中心坐标和五角星外接圆的半径 1.中心坐标 根据上面的链接提供的方法 , 我们比较容易的得出五个五角星的中心坐标,这里面都是纯数学的东西 // 这两个坐标可以理解为 基础偏移量 ,红旗的红色背景跟这个有关 CGFloat startXPoint = ( [UIScreen mainScreen] .bounds .size .width - wh_32_width)/ 2 ; CGFloat startYPoint = 120 ; // 红色 背景 wh_32_width 国旗宽度, wh_32_height 国旗高度 ,款比高 3:2的比例 UIColor *backGroundColor = [ UIColor redColor]; UIBezierPath *backPath = [UIBezierPath bezierPathWithRect:CGRectMake(startXPoint, startYPoint, wh_32_width, wh_32_height