calayer

AVPlayer not rendering to its AVPlayerLayer

放肆的年华 提交于 2021-02-04 19:54:05
问题 I have a AVPlayerLayer (subclass of CALayer) and I need to get in into a image type that can be passed to a QCRenderer (QCRenderer accepts NSImages and CIImages.) I can convert the CALayer to a CGImageRef, and that to an NSImage, but the contents is always clear. I've narrowed it down to one of two reasons: I am not creating the NSImage correctly. The AVPlayer is not rendering to the AVPlayerLayer. I am not receiving any errors, and have found some documentation on converting CALayers. Also,

Unexpected behaviour in animation when i change the properties of the model layers

烈酒焚心 提交于 2021-01-29 15:31:14
问题 Referring to this post, i'm trying to adapt the animations to landscape mode. Basically what i want is to rotate all layers of -90° (90° clockwise) and the animations to run horizontally instead of vertically. The author didn't bother to explain the logic under the hood, there are a dozen paper folding libraries in obj-c which are all based on the same architecture, so apparently this is the way to go for folding. EDIT : To further clarify what i want to achieve, here you can look at three

How to position CAShapeLayer in a UIView

折月煮酒 提交于 2021-01-29 11:46:40
问题 I saw many answers on Stack overflow, but none helped me. I created a DrawView where it's possible to draw. I created an instance of UIBezierPath for drawing. I want to transfer my drawing on a little view (the red one on the image). That's what I did: // This function is called when the user has finished to draw. override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { let shapeLayer = CAShapeLayer() //The CAShapeLayer has the same path of the drawing (currentPath is the

CAShapeLayer cutout in UIView

百般思念 提交于 2021-01-28 09:51:59
问题 My goal is to create a pretty opaque background with a clear rounded rect inset let shape = CGRect(x: 0, y: 0, width: 200, height: 200) let maskLayer = CAShapeLayer() maskLayer.path = UIBezierPath(roundedRect: shape, cornerRadius: 16).cgPath maskLayer.fillColor = UIColor.clear.cgColor maskLayer.fillRule = kCAFillRuleEvenOdd let background = UIView() background.backgroundColor = UIColor.black.withAlphaComponent(0.8) view.addSubview(background) constrain(background) { $0.edges == $0.superview!

Image View Double Border

♀尐吖头ヾ 提交于 2021-01-28 04:02:51
问题 I'm calling a function that sets up a UIImageView: func setupImageView(_ imageView: UIImageView) {} I want to give that UIImageView an image, round its corners, and give it two different borders. Here is what I am currently doing: imageView.image = imageConstants.imageThatIsWanted imageView.clipsToBounds = true imageView.layer.cornerRadius = imageView.frame.height / 2 imageView.layer.borderWidth = 3.0 imageView.layer.borderColor = UIColor.white.cgColor What is the best way to apply a second

UITableViewCell top shadow is covered by UITableView header view

て烟熏妆下的殇ゞ 提交于 2021-01-27 17:17:39
问题 I have a UITableView with a custom HeaderView (added via storyboard). I want to put a drop shadow on the first cell in the table view. Unfortunately, the header view covers the shadow. I am making the shadow in cellForRowAtIndexPath with: [cell setClipsToBounds:NO]; [cell.layer setMasksToBounds:NO]; [cell.layer setShadowOffset:CGSizeMake(0, 2)]; [cell.layer setShadowColor:[[UIColor blackColor] CGColor]]; [cell.layer setShadowRadius:4.0]; [cell.layer setShadowOpacity:1.0]; [cell.layer

Member access into incomplete type 'CALayer'

对着背影说爱祢 提交于 2021-01-27 11:52:26
问题 For the code below : CGRect frame = CGRectMake(0, 0, cellWidth, 240); MKMapView *mapView = [[MKMapView alloc] initWithFrame:frame]; mapView.layer.masksToBounds = YES; mapView.layer.cornerRadius = 10.0; I included MapKit,QuartzCore and CoreLocation Frameworks in addition. For the last 2 lines, I am getting error : "Member access into incomplete type 'CALayer'" Please tell me why I get this error and how to resolve this EDIT: I got this error as I did not import Quartz.h, but i still dont

Animate CALayer border change

空扰寡人 提交于 2021-01-16 08:19:57
问题 I'm setting a border width and color to a UIView subclass this way: - (void) setViewBorder { self.layer.borderColor = [UIColor greenColor].CGColor; self.layer.borderWidth = 3.0f; } My question is: How can I animate this? Thanks. 回答1: Both borderColor and borderWidth are animatable properties but since you are doing this in a view subclass outside of an UIView animation block, implicit animations (those that happen automatically when you change a value) are disabled. If you want to animate

Animate CALayer border change

a 夏天 提交于 2021-01-16 08:11:56
问题 I'm setting a border width and color to a UIView subclass this way: - (void) setViewBorder { self.layer.borderColor = [UIColor greenColor].CGColor; self.layer.borderWidth = 3.0f; } My question is: How can I animate this? Thanks. 回答1: Both borderColor and borderWidth are animatable properties but since you are doing this in a view subclass outside of an UIView animation block, implicit animations (those that happen automatically when you change a value) are disabled. If you want to animate

Animate CALayer border change

人盡茶涼 提交于 2021-01-16 08:11:35
问题 I'm setting a border width and color to a UIView subclass this way: - (void) setViewBorder { self.layer.borderColor = [UIColor greenColor].CGColor; self.layer.borderWidth = 3.0f; } My question is: How can I animate this? Thanks. 回答1: Both borderColor and borderWidth are animatable properties but since you are doing this in a view subclass outside of an UIView animation block, implicit animations (those that happen automatically when you change a value) are disabled. If you want to animate