core-animation

Change tabbarController's tab programmatically with animation

我是研究僧i 提交于 2019-12-01 08:45:57
I want to change tab through code with animation. Exact scenario is that there are 2 tabs with below hierarchy. First tab - Navigation controller - Login controller - Some other controller Second tab - Navigation controller - Screen with Logout button Now, if user presses logout, I need to display login screen. For that I need to switch tab to FirstTab and then popToRootViewController. So what I am doing is on logout button press I send NSNotification to LoginController which in turn executes below method. - (void)logoutButtonPressed { // Go to root controller in navigation controller of first

Core Animation rotation around point

会有一股神秘感。 提交于 2019-12-01 08:03:20
I would like to make an IBOutlet rotate around a specific point in the parent view, currently i only know how to rotate it around an anchor point, however, i want to use a point outside the object's layer. The rotation angle is calculated relative to the device heading from the point. - (void)viewDidLoad{ [super viewDidLoad]; locationManager=[[CLLocationManager alloc] init]; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.headingFilter = 1; locationManager.delegate=self; [locationManager startUpdatingHeading]; [locationManager startUpdatingLocation]; compassImage

Core Animation rotation around point

怎甘沉沦 提交于 2019-12-01 07:54:32
问题 I would like to make an IBOutlet rotate around a specific point in the parent view, currently i only know how to rotate it around an anchor point, however, i want to use a point outside the object's layer. The rotation angle is calculated relative to the device heading from the point. - (void)viewDidLoad{ [super viewDidLoad]; locationManager=[[CLLocationManager alloc] init]; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.headingFilter = 1; locationManager.delegate

UIImage as CAShapeLayer contents

萝らか妹 提交于 2019-12-01 07:22:56
问题 If I create a CAShapeLayer with just a background color it shows up, but if i set the content to an image, nothing shows. CAShapeLayer* leftDot = [CAShapeLayer layer]; leftDot.opacity = 1.0; leftDot.frame = CGRectMake(leftRef.CGPointValue.x, leftRef.CGPointValue.y, 2 * radius, 2 * radius); leftDot.position = CGPointMake(leftRef.CGPointValue.x + 4, leftRef.CGPointValue.y + 4); leftDot.cornerRadius = radius; [leftDot setContents:[UIImage imageNamed: @"glow.png"]]; [self.layer addSublayer:

How to sequence two animations with delay in between

浪子不回头ぞ 提交于 2019-12-01 07:15:39
I have a UIImageView which i want to rotate 180 degrees, taking up 1 second, then i want to wait 1 second at this position, then rotate 180 degrees back to the original position taking up 1 second. How do i accomplish this? I've tried a 100 approaches and it keeps snapping back instead of rotating back EDIT: I forgot to add i need this to repeat indefinitely You can perform the second animation in the completionHandler presented on UIView.animate let duration = self.transitionDuration(using: transitionContext) let firstAnimDuration = 0.5 UIView.animate(withDuration: firstAnimDuration,

Fill Color Animation Flickers when calling block in animation did stop

回眸只為那壹抹淺笑 提交于 2019-12-01 06:37:43
问题 Im having trouble figuring out why the animation is flickering from the fromValue to the toValue after my animation block is complete. I know that after you complete an animation you have to set the values of the CALayer to the end state of the animation to keep it looking consistent. Yet no matter what order i call these methods in i keep getting the flickering result. What I'm doing is drawing a checkmark with a biezer path and then once the strokeEnd animation is complete i fill in the

Get position of path at time

ぐ巨炮叔叔 提交于 2019-12-01 06:00:58
is there a nice way to calculate the position of a path (CGPath or UIBezierPath) at a given time (from 0 to 1)? Using CAShapeLayer for example, one can create an animated stroke end. I want to know the position of that stroke end at arbitrary times. Thanks in advance, Adrian You can definitely base your approach on the CADisplayLink and a tracking layer. However, if you don't mind doing a little bit of math on your own, the solution is not too complicated. Plus, you wont have to depend on setting up a display link and extra layers. In fact, you dont even have to depend on QuartzCore. The

Can a single CALayer be used as the mask for multiple other layers?

*爱你&永不变心* 提交于 2019-12-01 05:51:33
I can't find anything in the docs that indicates whether a single CALayer (or subclass) can be used as the mask property for multiple other layers. Is it possible? Or undefined? My experimentation says that it cannot. It will end up as the mask for the last layer it is attached to, and any previous layers it was assigned as a mask to, will revert to the default value of mask. It is possible. I combined mask of CAGradationLayer and CAShapeLayer. I made UIImage from two layers, and I use it to mask. You can generate image from CALayer like below. extension CALayer { func makeImage() -> UIImage {

Is it possible to use Core Animation to fade out a UIBarButtonItem?

女生的网名这么多〃 提交于 2019-12-01 05:41:52
I'm curious, is it possible to somehow intertwine Core Animation to give a "fade out" of a UIBarButtonItem? I have a tableView which I represent with two different data sources. Once a particular data source gets triggered, I'd like to fade out the current UIToolBar options and fade in new ones. Thanks for pointing me in the right direction. If you really are using a UIToolbar (note the lower-case "b") and not a UINavigationBar, there is a very easy way to change the buttons and have the transition automatically fade without dropping to Core Animation. If you're using Interface Builder, you'll

how can I detect the completion of an animation triggered by CATransaction

陌路散爱 提交于 2019-12-01 05:34:59
I have a CALayer which I merely create and add to a subview of my view controller's main view in the controller's initWithNibName: And then, I perform the following animation: [CATransaction begin]; [CATransaction setAnimationDuration:2]; [logoLayer setOpacity:0]; [CATransaction commit]; How can I tell when this animation is done? the performSelector: delayed by 2 secs. approach doesn't seem "the right way" to go about it. barley According to the doc , [CATransaction setCompletionBlock:] could be used for what you want. It says The completion block object is guaranteed to be called (on the