core-animation

NSImageView is hoping when from the location when trying to rotate. How to stop it?

自古美人都是妖i 提交于 2019-12-02 10:13:05
I am rotating an NSImageView from its center which is working perfectly however when I start the animation the NSImageView hops from its location to a random location. I do not know why is it happening. Please help. I am elaborating how I am doing it all. Also, I am providing a Github link so that you may run it if you want. github project link Code: // on button press animation will be started -(void)buttonPressed:(id)sender{ // setting the anchor point of the view _img.layer.anchorPoint = CGPointMake(0.5f, 0.5f); // calling the animation function [self startRefreshAnimation]; } // in order

Animation Snaps back when the UIImage is changed

三世轮回 提交于 2019-12-02 08:07:51
I have an UIImageView that runs across the screen when a button is pressed and held. When the button is pressed is changes the UIImage of the UIImageView and when the button is let go I change it to its original UIImage. When ever the image changes back it snaps back to the location that the image started. This Timer is called when the button is pressed: //This is the image that changes when the button is pressed. imView.image = image2; runTimer = [NSTimer scheduledTimerWithTimeInterval:0.04 target:self selector:@selector(perform) userInfo:nil repeats:YES]; This is called When the button stops

How do I achieve a clearly rendered rotated UILabel?

断了今生、忘了曾经 提交于 2019-12-02 07:52:32
I am trying to display rotated text. The UILabel is added as a subview on a UIImageView. The UIImageView has a transform created via say CGAffineTransformMakeRotation(M_PI/4.0). The text of the UILabel renders fairly blurry cf. the title label (in the screenshot, the blue background 'What's ...'). Do you know how I can manage to make the rotated text render clearly? I've already tried using an integral-based frame (which matters little since it'll be rotated), a non-clear background color, and setting the label to opaque=YES. Still blurry. Thanks! The problem is that your label is rendered in

Non-animatable properties in subclasses of CALAyer

吃可爱长大的小学妹 提交于 2019-12-02 04:38:00
问题 I have defined a subclass of CALayer with an animatable property as discussed here. I would now like to add another (non-animatable) property to that layer to support its internal bookkeeping. I set the value of the new property in drawInContext: but what I find that it is always reset to 0 when the next call is made. Is this so because Core Animation assumes that this property is also for animation, and that it "animates" its value at constant 0 lacking further instructions? In any case, how

Core Animation for UIView.frame

依然范特西╮ 提交于 2019-12-02 03:16:29
I'm trying to do a simple animation of moving the frame of two views. Basically hiding the Ad until it is loaded, and then move the frame up from the bottom, along with the view that starts at the bottom, and then will move up also when the Ad pushes it up. The start and end positions are correct, but I don't see it being animated. Is this correct? Thanks. CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"frame"]; animation.duration = 1.0; CGRect adFrame = CGRectMake(self.adBanner.frame.origin.x, self.adBanner.frame.origin.y - self.adBanner.frame.size.height, self

Combining an animation of an UIImageView with a transition

自作多情 提交于 2019-12-02 02:17:49
问题 I am doing a transition of an UIImageView's image and would also like to move the image view at the same time. The results so far is that the image transitions, but not while moving. class ViewController: UIViewController { @IBOutlet weak var imageView: UIImageView! @IBOutlet weak var imageViewTopConstraint: NSLayoutConstraint! override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) UIView.transition(with: imageView, duration: 2.0, options: .transitionCrossDissolve,

Combining an animation of an UIImageView with a transition

我的梦境 提交于 2019-12-02 01:40:49
I am doing a transition of an UIImageView's image and would also like to move the image view at the same time. The results so far is that the image transitions, but not while moving. class ViewController: UIViewController { @IBOutlet weak var imageView: UIImageView! @IBOutlet weak var imageViewTopConstraint: NSLayoutConstraint! override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) UIView.transition(with: imageView, duration: 2.0, options: .transitionCrossDissolve, animations: { self.imageView.image = UIImage(named: "otherImage") }, completion: nil)

Unable to setContentOffset in scrollViewDidEndDragging

匆匆过客 提交于 2019-12-02 00:50:39
问题 I am attempting to modify the contentOffset of my scroll within the following delegate method: - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate I have tried both of the following: [UIView animateWithDuration:.2 animations:^ { [scrollView setContentOffset:CGPointZero animated:NO]; }]; and [UIView animateWithDuration:.2 animations:^ { CGRect svBounds = self.bounds; svBounds.origin.y = 0; self.bounds = svBounds; }]; The problem is that although this

Animate a custom property using CoreAnimation in Monotouch?

主宰稳场 提交于 2019-12-02 00:48:52
问题 This is essentially the same question as posted here: Animating a custom property in a CALayer over a year ago and hasn't been answered. Im creating a custom layer and drawing a circle on it. I'd like to be able to animate the radius of the circle (and other properties later). From what i've read, i've set it up like so: public class CircleLayer : CALayer { //[Export("radius")] //public float Radius { get;set; } //EDIT: I've now changed the radius field to what is coded below public float

Revolving animation, that follows finger, of uibuttons that follows outer path of circle

孤街浪徒 提交于 2019-12-01 23:58:17
问题 I am looking for a little guidance to start figuring out an animation that tracks finger movement and moves a collection of UIButtons along the outer path of a circle I am picturing it will kind of have a revolver feel to it. Like each one locks into place at the bottom or like the swiping through one of the slide inserts of these thanks in advance 回答1: (Sample code on GitHub) It's not really that difficult, there's just a lot of trigonometry involved. Now, what I'm going to describe now, is