uibezierpath

'Display Zoom' iPhone 6/6s setting blurs graphics

青春壹個敷衍的年華 提交于 2019-12-25 05:36:12
问题 I'm writing a project in Xcode 7 / Swift 2 that it is optimized for iPhone 6/6s (i.e. the project has a launch screen file and launch screen images for iPhone 6/6s). Fortunately or unfortunately, iPhone 6 users have the ability to turn on the ‘Display Zoom’ setting on device which enlarges elements of the interface. When turned on, this setting effectively enlarges a standard iPhone 5 screen size to fit in the iPhone 6 screen space, upsampling to x1.171875. This upsampling causes elements

Merge connected UIBezierPaths

自闭症网瘾萝莉.ら 提交于 2019-12-25 05:09:54
问题 Is there some way (code or pseudo-code algorithm) to utilize UIBezierPath instance methods like appendPath to "merge" any number of connected, distinct UIBezierPath s into a single big path? In a document with many paths, I am trying to reduce the encoded file size by perhaps reducing the number of paths as there is surely some redundant information there. If I am barking up the wrong tree, let me know. 回答1: well if its only an esthetically problem...just set the first point of the 2nd bezier

UIBezierPath moved half aside

久未见 提交于 2019-12-25 01:43:39
问题 I'm trying to draw along an UIBezierPath to a view. The weird thing is, it starts with an offset of 50% of the view. The grey part is the view and the lines are what I'm drawing. Here is my code: lineLayer.bounds = CGRectMake(0, 0, self.bounds.width, self.bounds.height); lineLayer.strokeColor = UIColor.blackColor().CGColor lineLayer.lineDashPattern = [3, 2, 1, 2, 1, 2, 1, 2, 1, 2] lineLayer.lineWidth = lineLayer.bounds.height var linePath = UIBezierPath() linePath.moveToPoint(CGPointMake(0,

Smooth UIBezierPath

情到浓时终转凉″ 提交于 2019-12-25 00:14:03
问题 I created in a playground a uibezierpath added manually values and it works fine. The results is : Now my goal is to smooth the curve and remove these "sharp" corners. I'm thinking on a interpolation function but not sure. Below my actual code : //: Playground - noun: a place where people can play import Foundation import UIKit import CoreGraphics import QuartzCore class DemoView: UIView { override func draw(_ rect: CGRect) { let origin = CGPoint(x: frame.size.width / 2, y: frame.size.height

Getting all points (not only control points) from UIBezierPath

∥☆過路亽.° 提交于 2019-12-24 11:35:35
问题 I have a UIBezierPath which i defined, and i can access the relevant points defined. Now, i want to extract all the points in the line, not just the points i defined. I saw these following questions: Question 1 Question 2 And i was wondering if using the answers selected will give the result i want, meaning: 1) Extract all points (already have them) as suggested in question 1 2) Calculate all the points between each pair (or triplet) of points as suggested in question 2 Is this the right

CAShapeLayer custom property is nil when drawInContext

半城伤御伤魂 提交于 2019-12-24 09:16:08
问题 I denfined a custom layer,and declare a custom property,but it's not work when animation in -(void)drawInContext:(CGContextRef)ctx method here is some code: @interface ZBBProgressLayer : CAShapeLayer @property (nonatomic, assign) CGFloat progress; @property(nullable) CGColorRef progressColor; @end @implementation ZBBProgressLayer + (BOOL)needsDisplayForKey:(NSString *)key{ if ([key isEqualToString:@"progress"]/*progress 属性变化时,重绘*/) { return YES; } return [super needsDisplayForKey:key]; } -

Fitting UIBezierPath/CGPath to circle

限于喜欢 提交于 2019-12-24 07:27:38
问题 I need to aspectFit arbitrarily shaped paths to the interior of a circle. I can fit rectangular paths to the circle by calculating the size, building a dest rect, then scaling the path to fit the dest rect. let targetSize = circleDiameter / sqrt(2) let destRect = CGRect(x: 0, y: 0, width: targetSize, height: targetSize) // ... Scale the path to the rect, using boundingBox of path. But the scaling process isn't the issue; it's really how to calculate the required scale. A bounding-box based

Masking a CAShapeLayer creates this weird artifact?

不羁的心 提交于 2019-12-24 06:04:05
问题 I want to create a smooth progress bar for a to-do list. I used a circle (CGMutablePath) that masks the gray area and there's an obvious arc-like artifact. Not only that but there's also an artifact on the right side of the bar. Note: I tried to rasterize the layers to no avail. What causes iOS to do this and how can I smooth this out or get rid of it? private var circleMask: CAShapeLayer = CAShapeLayer() override func layoutSubviews() { super.layoutSubviews() backgroundColor = GradientColor(

How to stretch image into custom shape (swift3)

拈花ヽ惹草 提交于 2019-12-24 04:36:06
问题 The code list below crops the image. I would like the image to be transformed/ stretched and not cropped in the shape. All of the image contents are still in the transformed picture. It will just look different. extension UIImageView { func addMask(_ bezierPath: UIBezierPath) { let pathMask = CAShapeLayer() pathMask.path = bezierPath.cgPath layer.mask = pathMask } } let myPicture = UIImage(data: try! Data(contentsOf: URL(string:"https://scontent-iad3-1.xx.fbcdn.net/v/t31.0-8/14196150

Eraser for UIBezierPath

孤街浪徒 提交于 2019-12-24 00:53:23
问题 I am using UIBezierPath for free hand drawing in an iPad app. I want to apply an eraser to a uibezierpath. However, I want to only erase the drawing in its path. I cannot use the path color as the background color because I have other elements on the background. Below is how I am creating my free hand drawings: - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor clearColor]; self.opaque = NO; lineWidths = 10; brushPattern =