uiviewanimation

Auto layout and UIViewAnimation - Gap between two connected views

断了今生、忘了曾经 提交于 2019-12-12 05:38:27
问题 I created a "tooltip" view that has a UILabel and an UIView with a CAShapeLayer for a triangle shape. I have setup the "tooltip" so that the label is on top, with the triangle attached to the bottom and centered on the UILabel. When I show the "tooltip", I use the UIViewAnimation with Spring Damping and Spring Velocity to give it a "pop" animation. This works great with one exception, a small gap can be noticed between the triangle and the UILabel during the beginning of the animation (which

Cannot call value of non-function type 'CGFloat' with the alpha property

烂漫一生 提交于 2019-12-12 04:16:18
问题 I am debugging a dropdown menu I converted from Objective-C. In it, I have this function: func showMenu() { self.menu.hidden = false self.menu.translatesAutoresizingMaskIntoConstraints = true closedMenuShape.removeFromSuperlayer() if shouldDisplayDropShape { self.view.layer.addSublayer(openMenuShape) } // Set new origin of menu var menuFrame: CGRect = self.menu.frame menuFrame.origin.y = self.menubar.frame.size.height - self.offset() var containerAlpha: CGFloat = fadeAlpha if SYSTEM_VERSION

Why do UIView & UIImageView animate differently?

时间秒杀一切 提交于 2019-12-12 03:56:02
问题 I have 4 buttons, all use the same animate func imageViewWithoutDelay imageViewWithDelay ViewWithoutDelay ViewWithDelay my code: import UIKit class ViewController: UIViewController { @IBAction func imageViewithoutDelay(_ sender: AnyObject) { let circleImage = UIImageView() // kindly add your own image. circleImage.image = UIImage(named: "empty") animate(inputView: circleImage, delay: false) } @IBAction func imageViewWithDelay(_ sender: UIButton) { let circleImage = UIImageView() circleImage

UIAnimation repeating issue in Swift

大城市里の小女人 提交于 2019-12-12 02:09:02
问题 I have a simple UIButton in my project with animation block running inside the button. Basically, I have a mainButton that connected to two other sub Buttons. When mainButton is pressed, my subButtons will appear to the view with animation. I am using the following code. @IBOutlet weak var mainButton: UIButton! @IBOutlet weak var subButton1: UIButton! @IBOutlet weak var subButton2: UIButton! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view,

UIViewanimation trantitionfromView using UIViewflip animation

我们两清 提交于 2019-12-11 16:28:56
问题 Building an app containing flashCards. They surely require the ability to flip a card. To do this i have a UIViewController and to avoid flipping the whole view I've implemented my subView into a container. I have declared two subviews in the container named, frontView and backView . frontView got red background and label saying front while backView got a blue background and label saying back. I have declared a variable so i can check which side is showened : var showingFront = true Got a

How to set UIButton with image in animation?

半腔热情 提交于 2019-12-11 14:57:38
问题 For some reason my animation is not waiting 10 seconds to execute. It is executing as soon as I lift the finger off the button and the button is not red animated. SomeClass: UIViewController { override func viewDidLoad() { super.viewDidLoad() tapBeatButton.addTarget(self, action: #selector(tapBeatButtonTouchedDown), for: UIControl.Event.touchDown) tapBeatButton.addTarget(self, action: #selector(tapBeatButtonTouchedUpInside), for: UIControl.Event.touchUpInside) } @objc func

UIView bottom to top animation issue

◇◆丶佛笑我妖孽 提交于 2019-12-11 13:08:51
问题 This is a simple function I am using for animating a view from top to bottom and vice versa (if is top to bottom animation and else is bottom to top animation) : @objc func openMenu(sender: UIButton) { if sender.tag == 1 { self.buttonView.tag = 2 self.moduleView = ModulesCollectionView(frame: CGRect(x: 0, y: self.frame.origin.y + self.frame.size.height + 20, width: UIScreen.main.bounds.size.width, height: 0), collectionViewLayout: UICollectionViewLayout()) self.window?.addSubview(self

Is it posible to do multiple animations on UIView without using completion block

强颜欢笑 提交于 2019-12-11 11:57:38
问题 This is simple question just for illustrating point, my concrete code is much more complicated. Let say that I have UILabel that is position on TOP LEFT. With this code, I will move it to TOP RIGHT: // labelMove is moved to TOP RIGHT [UIView animateWithDuration:1.0f delay:2.0f options:UIViewAnimationOptionCurveEaseOut animations:^ { labelMove.center = CGPointMake(250.0f, 40.0f); } completion:nil]; If I have this code: // labelMove is moved to TOP RIGHT [UIView animateWithDuration:1.0f delay:2

Simulator Freezes at Animation Blocks After Swift 5 / Xcode 11 Update

强颜欢笑 提交于 2019-12-11 06:07:19
问题 I updated my project to Swift 5 in Xcode 11 and now the program freezes at my animation blocks in the iPhone 11 simulator. When I set a breakpoint after the animation it never hits it. Restarting Xcode and the Simulator did not solve the issue. If I run the program on a device it works fine. Any ideas about what's going on? Maybe a memory issue? UIView.animate(withDuration: 1, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.5, options: [UIView.AnimationOptions.curveEaseIn],

Updating running animations smoothly

被刻印的时光 ゝ 提交于 2019-12-11 05:19:20
问题 I have a number of images I run continuous animations on. How does one update these running animations smoothly so that there is no visible transition between them, unless part of the animation. e.g. rotating and scaling an image, and then updating the animation to rotate as it was, but scale up slightly. I currently get a visible change. I can imagine that that scaling should be done within an animation block and them just run the rotation animation as before, the issue would be then that