core-animation

Swift 3 : issue with AVVideoCompositionCoreAnimationTool to add watermark on video

左心房为你撑大大i 提交于 2019-12-09 01:34:24
问题 The following code was working perfectly to add a logo and a text to a video with AVVideoCompositionCoreAnimationTool. Then Swift 3 came! Now sometimes the video shows with the logo and text sometimes the video does not show when it is exported. let videoComposition: AVMutableVideoComposition = AVMutableVideoComposition() videoComposition.frameDuration = CMTimeMake(1, 60) videoComposition.renderSize = CGSize(width: clipVideoTrack.naturalSize.height, height: clipVideoTrack.naturalSize.height)

How do you rotate UIView, UIImageView or CALayer animated 360˚?

纵饮孤独 提交于 2019-12-09 00:40:46
问题 How do you rotate UIView , UIImageView or CALayer animated 360 degress without using OpenGL ES? 回答1: #import <QuartzCore/QuartzCore.h> CABasicAnimation *fullRotation; fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; fullRotation.fromValue = @(0.0); fullRotation.toValue = @((360.0 * M_PI)/180.0); fullRotation.duration = 3.5f; fullRotation.repeatCount = MAXFLOAT; [view.layer addAnimation:fullRotation forKey:@"rotation-animation"]; If you want to change the anchor

Flatten CALayer sublayers into one layer

本小妞迷上赌 提交于 2019-12-09 00:21:01
问题 In my app I have one root layer, and many images which are sublayers of rootLayer. I'd like to flatten all the sublayers of rootLayer into one layer/image, that don't have any sublayers. I think I should do this by drawing all sublayers in core graphics context, but I don't know how to do that. I hope you'll understand me, and sorry for my English. 回答1: From your own example for Mac OS X: CGContextRef myBitmapContext = MyCreateBitmapContext(800,600); [rootLayer renderInContext:myBitmapContext

How to remove a CALayer-object from animationDidStop?

大城市里の小女人 提交于 2019-12-08 17:26:20
问题 I am trying to learn core-animation for the iOS/iPhone. My root layer contains a lot of sublayers (sprites) and thay should spin when they are removed... My plan was to add a spinning animation and then remove the sprite when the animationDidStop is invoked. The problem is that the sprite layer is not a parameter to animationDidStop! What is the best way to find the specific sprite layer from animationDidStop? Is there a better way to make the sprite spin when it is removed? (ideally I would

How do I prevent custom UITableViewCells from flashing white on deselecting?

[亡魂溺海] 提交于 2019-12-08 17:22:56
问题 I have a custom UITableViewCell which changes color based on which row it is in: TableViewController.m - (void)willDisplayCell:(GSRSongCell *)cell atIndexPath:(NSIndexPath *)indexPath; { if (indexPath.row % 2 == 0) { [cell lighten]; } else { [cell darken]; } } CustomTableViewCell.m - (void)lighten { self.selectedBackgroundView.backgroundColor = [UIColor whiteColor]; self.contentView.backgroundColor = [UIColor whiteColor]; self.primaryLabel.backgroundColor = [UIColor whiteColor]; self

UIViewPropertyAnimator issue with Autolayout

為{幸葍}努か 提交于 2019-12-08 12:33:15
问题 Here is the code of what I tried to repeat according to Apple WWDC but with autolayout: extension AugmentedReallityViewController { @objc func handlePan(recognizer: UIPanGestureRecognizer) { // // hide languages and units anyway // moveUnitView(show: false) // moveLanguageView(show: false) // // let isNowExpanded = settingsPanelState == SettingsPanelState.expanded // let newState = isNowExpanded ? SettingsPanelState.collapsed : SettingsPanelState.expanded // // switch recognizer.state { //

QuartzCore shadow - lag UITableView?

时光总嘲笑我的痴心妄想 提交于 2019-12-08 12:15:46
问题 I have an UITableView (NOTE:The UITableView is in a UIView) and I thought it would be nice to have an shadow added below it. I add the shadow with QuartzCore and it turns out really nice. But I also notice that when I come back from a 'Detail View' the animation back to the root is a bit lag. I've heard that QuartzCore and CoreAnimation can make the app slower, or in this case, add lag. First, am I right that CoreAnimation makes the app slower? If so, how can I keep my shadow but remove the

how Add mirror image to 2d Box corners

ぃ、小莉子 提交于 2019-12-08 11:42:40
问题 hello friends i need to add mirror image in right corner and bottom . i create the type of view with the help of this answer how to create a view like this shape in swift? but i am not able to add image in right corner and bottom 回答1: Current approach is somewhat different from the previous one. Previously i've drawn the right and bottom corner and resized the image such that, the appearance is asked in that question. But in this question, that approach won't work anymore. First reason is

UITableView + Core Animation

点点圈 提交于 2019-12-08 09:43:34
问题 I would like to build up a table view section into my iOS app just like the Facebook style (with many information in every row, images and buttons, ..). I also want to include Core Animation effects on every row, like fade out the cell, or customize the graphic interface. Do you recommend me to use the UITableView class or something else more 'customizable'? 回答1: You should use the regular UITableView , but custom UITableViewCells . UITableView 's support fading and other kind of animations

How to manage CALayer animations throughout a hierarchy

為{幸葍}努か 提交于 2019-12-08 08:21:16
问题 This is a follow-up question to How to synchronize CALayer and UIView animations up and down a complex hierarchy Lets say I have a composite layer (Top) that is a subclass of CALayer and has any number of children. Top has 2 child layers within it. The first sublayer (A) should always be a fixed width - lets say 100 pixels wide. The second sublayer (B) should be the remainder of the size of Top. Both A and B should occupy the entire height of Top. This is pretty straightforward to code up in