2,864 questions
0
votes
1
answer
38
views
Animate CALayer Contents Change
I have a CALayer that I update the contents with a CGImage of a UIImage
self.imageLayer.contents = newImage.cgImage
I want to animate this change. First I tried this and did not work:
CATransaction....
0
votes
1
answer
117
views
Draw PDF with a different colour in a CALayer. (Objective-C)
I've loaded a black and transparent .PDF icon to a CGPDFPageRef and need to draw it out to a CALayer with a specified colour. I can scale and rotate it correctly but don't know how to change the ...
1
vote
2
answers
434
views
in iOS17 UIKit is there a way to change/affect the border color of an iOS17 UITextField (other than the mangle shown here)?
This is about iOS 17 only. The only way I could hack around and achieve something like this was
find the actual, real, border, get its real values
sadly just add a fake on top of that layer once ...
0
votes
0
answers
2k
views
App crashes of type EXC_BREAKPOINT (SIGTRAP) SIGNAL 5 Trace/BPT trap on iOS17
I'm encountering crashes of type EXC_BREAKPOINT (SIGTRAP) Termination Reason: SIGNAL 5 Trace/BPT trap: 5 on iOS 17.
In the iOS app I'm developing, I've noticed that since upgrading to iOS 17 (Xcode 15....
1
vote
1
answer
73
views
Performance slowdown and inaccuracies in stroke rendering due to float-based distance calculation in drawing
Description:
I'm currently working on a Drawing application and facing challenges with stroke rendering due to the use of float-based distance calculations.
While attempting to convert integer ...
0
votes
1
answer
78
views
Issue with Sequential Touch Points in Using CALayer for Drawing in Swift
I'm encountering an issue with my drawing functionality in Swift, specifically when using CALayer instead of UIBezierPath. Here's the problem I'm facing:
I am creating a texture from an image and ...
1
vote
1
answer
314
views
why does write addSublayer twice to block screenshot in swift?
I found an extension function to block screeenShot in iOS.
But I wounder to know why addSublayer twice.
self.layer.superlayer?.addSublayer(textfield.layer)
textfield.layer.sublayers?.last?....
2
votes
0
answers
42
views
How to make CALayer adapt to the application appearance using drawlayer:inContext:?
I have a layer-hosting NSView subclass that draws itself using a CALayer object set as its layer. Since it's not a layer-backed view, it doesn't redraw during drawRect: nor during updateLayer, but ...
0
votes
1
answer
124
views
Synchronize UIView CALayer draw with UIScrollView
I'm trying to make an application that will draw on top of a pdf. It is required that graphic shapes be tied to a specific position on the page.
To solve the problem, I use PDFView and CALayer, listen ...
1
vote
2
answers
89
views
CALayer disappears when storing in a property
I have a custom UIPresentationController in which I overrode the presentedView as follows:
override var presentedView: UIView? {
guard let view = super.presentedView else { return nil }
...
0
votes
1
answer
352
views
How to make a CALayer with NSImage dynamically adapt to the app appearance?
I have an NSView whose layer has various sublayers.
Its needsDisplay property is set to YES when the app changes its effective appearance, which ends up calling:
-(void)updateLayer {
// this is ...
-1
votes
1
answer
176
views
How to rotate a CAShapeLayer around some point with animation?
A custom view has some CALayers as its content.
I want to add a consistent rotation animation for the red line. (imagine it as pointer of an analog clock)
Expected result: the red line rotates at the ...
0
votes
1
answer
110
views
Using custom shadow path on NSView
Unfortunately it seems that setting the shadow attributes on the layer directly doesn't work:
let shadowView = NSView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
shadowView.wantsLayer = true
...
0
votes
1
answer
125
views
How to rotate CALayer and cover complete View on device rotation?
I have applied a gradient to a custom UIView by adding a CAGradientLayer. While this works fine there is small glitch when rotating the device and the view + layer with it. For a short moment the ...
1
vote
0
answers
84
views
How to draw NSAttributedString with .background attributes and insets?
I need to draw in CALayer subclass NSAttributedString with background for every line of text and insets(horizontal and vertical). How to do that?
I am trying this code. But, I can't set insets text ...
0
votes
1
answer
213
views
How to specify which child view does not inherit shadows when setting shadows for the parent view?
I want bView to be free of shadows. How can I achieve this?
I want to shadow all subviews of the superView, so I cannot remove the shadow settings of the superView.
let superView: UIView = UIView(...
1
vote
2
answers
883
views
How to achieve better performance in converting UIView to CVPixelBuffer?
I'm wondering if it's possible to achieve a better performance in converting the UIView into CVPixelBuffer.
My app converts a sequence of UIViews first into UIImages and then into CVPixelBuffers as ...
0
votes
0
answers
45
views
Is it possible to animate individual draw calls in a CALayer?
I'm drawing in a single CALayer between 100 and up to 1000 dots (colored circles actually) in a grid, when each dot state changes from hidden to shown and viceversa. So this layer is drawn quite a lot....
0
votes
1
answer
57
views
CALayer "floating" within NSScrollView?
I'd like to have a CALayer "float" over my scroll view's documentView. That is, it shouldn't move during scrolling.
If I add a CALayer to my NSSCrollView's layer, the added layer is masked ...
0
votes
1
answer
235
views
How do I add both shadow and rounded corners to a UIVisualEffectView?
I'm using a container for elements which I'd like for it to be blurred. In order to add rounded corners I modified the layer while for the shadow I created a second view named containerShadow and ...
0
votes
1
answer
112
views
How can i draw lines from touches in single CAShapeLayer to be able to select and move UIBezierPaths?
I'm trying to draw lines with touches and then be able to move it. i didn't use UIContext method with draw(_ rect: CGRect) for drawing because i wasn't able to get size of stroke and some of it's ...
0
votes
1
answer
272
views
How to check CAShapeLayer is visible on screen or not - Swift?
I want to check if CAShapeLayer is visible on screen or not. Does anybody now how to do?
0
votes
0
answers
42
views
CALayer Layout Animation
I have a view that has subviews alongside sublayers.
myView
var myView1 : UIView!
var myLayer1: CALayer
override final func viewWillLayoutSubviews() {
super....
0
votes
1
answer
205
views
Prevent `CALayer` from dropping shadow set by its parent layer
Recently I've been playing around with shadows and one particular case got me really interested. Suppose I have a parent CALayer which has three oval-shaped sublayers laid in a stack. I applied shadow ...
0
votes
1
answer
94
views
How to draw same size dotted line on UIView
Can someone please guide how I can draw same size dotted line on UIView for all sides?
I am using below code to draw line.
let dashBorder = CAShapeLayer()
let frameSize = self.frame.size
let shapeRect ...