UIViewPropertyAnimator doesn’t work as expected

UIViewPropertyAnimator doesn’t work as expected

Content Index :

UIViewPropertyAnimator doesn’t work as expected
Tag : ios , By : Michael T.
Date : January 11 2021, 05:14 PM

it helps some times Fiexd it, just add view.layoutIfNeeded() between the two lines of code inside the property animator.
// When the user taps on the featured story image view
    @objc func feturedStoryTapped() {

    /*featuredStoryView.layer.zPosition = 1

    // Hide the necessary elements
    self.featuredTitle.isHidden = true
    self.bookTitle.isHidden = true
    self.authorName.isHidden = true

    // Unhide the necessary elements
    self.exitButton.isHidden = false*/

    let animator = UIViewPropertyAnimator(duration: 0.9, dampingRatio: 0.4, animations: {

        self.featuredStoryView.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height)

        self.bookCover.frame = CGRect(x: 100, y: 75, width: 250, height: 280)




No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

on() doesn't work as expected and does not work for newly loaded content

Tag : jquery , By : Enrique Anaya
Date : March 29 2020, 07:55 AM
This might help you My chrome extension is as follows:
$(document).on("keypress", "input[type!='password'], textarea", function (event) {
    alert("this works!");

'UIButton.titleLabel?.text' doesn't work as expected/doesn't overwrite string

Tag : swift , By : Reiner
Date : March 29 2020, 07:55 AM
wish help you to fix your issue As I explained earlier, don't use nil for an empty string. The following works for me. Also it turns out (after scanning the docs) that UIButton.titleLabel is read only. Its own properties are read/write but the titleLabel itself is read only, hence why you have to use setTitle and why using sender.titleLabel?.text doesn't work in the if statement. Try the following.
override func viewDidLoad() {


func CheckWin() -> Bool
    if button1.title(for: .normal) == button2.title(for: .normal) && button2.title(for: .normal) == button3.title(for: .normal) && button1.title(for: .normal) != ""
        return true
        return false

@IBAction func buttonClick(_ sender: UIButton)
    if sender.title(for: .normal) == ""
        if player%2==0
            sender.setTitle("X", for: .normal)
            player += 1
            turn += 1
            label.text = "Player 'O' Turn"
            sender.setTitle("O", for: .normal)
            player += 1
            turn += 1
            label.text = "Player 'X' Turn"
    if CheckWin()

func resetButtons() {

    button1.setTitle("", for: .normal)
    button2.setTitle("", for: .normal)
    button3.setTitle("", for: .normal)

Why does UIView.animate work with an interactive controller transition, but UIViewPropertyAnimator doesn't?

Tag : ios , By : Johannes
Date : March 29 2020, 07:55 AM
Does that help With introduction of the UIViewPropertyAnimator in iOS 10 the UIViewControllerAnimatedTransitioning protocol got updated, too. They've added an optional func interruptibleAnimator(using: UIViewControllerContextTransitioning) that you don't have to implement (I guess for backward compatibility). But it was added exactly for the use case you mention here: to take advantage of the new UIViewPropertyAnimator.
So to get what you want: first, you have to implement interruptibleAnimator(using:) to create the animator - you don't create it in animateTransition(using:).
private var animatorForCurrentSession: UIViewImplicitlyAnimating?
class BackAnimator : NSObject, UIViewControllerAnimatedTransitioning {
    // property for keeping the animator for current ongoing transition
    private var animatorForCurrentTransition: UIViewImplicitlyAnimating?

    func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
        return 0.5

    func interruptibleAnimator(using transitionContext: UIViewControllerContextTransitioning) -> UIViewImplicitlyAnimating {
        // as per documentation, the same object should be returned for the ongoing transition
        if let animatorForCurrentSession = animatorForCurrentTransition {
            return animatorForCurrentSession
        // normal creation of the propertyAnimator
        let view_From       = transitionContext.viewController(forKey: .from)!.view!
        let view_To         = transitionContext.viewController(forKey: .to)!.view!
        transitionContext.containerView.insertSubview(view_To, aboveSubview: view_From)

        view_To.alpha = 0
        let animator = UIViewPropertyAnimator(duration: transitionDuration(using: transitionContext), curve: .linear)
        animator.addAnimations {
            view_To.alpha = 1
            view_From.alpha = 0
        animator.addCompletion { (position) in
            switch position {
            case .end: print("Completion handler called at end of animation")
            case .current: print("Completion handler called mid-way through animation")
            case .start: print("Completion handler called  at start of animation")
            // transition completed, reset the current animator:
            self.animatorForCurrentTransition = nil

        // keep the reference to current animator
        self.animatorForCurrentTransition = animator
        return animator

    func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
        // animateTransition should work too, so let's just use the interruptibleAnimator implementation to achieve it
        let anim = self.interruptibleAnimator(using: transitionContext)

why doesn't my wsb2812 led work as i expected, the last led doesn't work

Tag : c , By : Manu
Date : March 29 2020, 07:55 AM
This might help you You loop from 24 to 1 in your ws281x_colorWipe_rollback function, but you want it from 23 downto 0:
for(int16_t i = PIXEL_NUM-1 ; i >= 0; i --)

vagrant ssh doesn't work as expected, it doesn't honor my custom settings

Tag : ssh , By : kiirpi
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Is there a better way to watch for a key-value change?
  • How to make UIBezierPath to fill from the center
  • Why on Xcode 11, UICollectionViewCell changes size as soon as you scroll (I already set size in sizeForItem AtIndexPath:
  • How to scan non LE devices using Swift?
  • Unable to infer closure type in the current context in SwiftUI
  • What is the best way to write common code and use it entire project
  • UISegmentedControl inside UIStackView, segments text not centered - iOS 13
  • Swift & ObjC bridge - cannot find protocol declaration for "WKNavigationDelegate"
  • SwiftUI How to push to next screen when tapping on Button
  • 'NSApp' is unavailable in UIKit for Mac: How to embed Mac only framework in iOS app on macOS?
  • UserDefaults Binding with Toggle in SwiftUI
  • How to create a color with an alpha value using SwiftUI?
  • SwiftUI creates destination views before the user navigates to them
  • Streaming video from https with AVPlayer causes initial delay
  • Tap Action not working when Color is clear SwiftUI
  • SwiftUI NavigationButton: How to navigate to different destinations
  • Supported default light/dark mode colors for Color vs UIColor
  • XCUITest wait for a cell with a specific static text inside it
  • Not able to enable Development mode on iOS 13
  • How to hide the home indicator with SwiftUI?
  • How to write if condition with using label text (Int) values
  • Swift Cannot use instance member within property initializer
  • Issue while getting the frame of the keyboard
  • dynamicMemberLoookup ExpressibleByStringLiteral parameter swift
  • iOS Unity Firebase Messenger Xcode Compile Error: FIRDynamicLinks
  • Firebase Storage Image Cache not updating SWIFT
  • unhandled js exception: application main has not been registered expo TestFlight
  • App freezes on IOS when navigate to another screen - React Navigation
  • How to create haptic feedback for a Button in SwiftUI?
  • How can I achieve automatic scrolling in my text view when text comes down to the keyboard level in Swift?
  • how to get the location with the CLLocationManager every 10 secondes?
  • Calling completion handler of a function from Timer selector function Swift
  • How to make SwiftUI view fullscreen?
  • RAM, JSC, Views, UI and JS usage table appearing whenever I launch my react native app. How to remove this table?
  • Change status bar background color using UIStatusBarManager
  • Should we make tapGesture component an IBAction or IBOutlet to capture the tap event?
  • Iframe automatically goes full screen using Ionic 3.9.2 on iOS
  • How to calculate score out of 1000 given some seconds (In Double)
  • How to calculate time (minutes) between two dates in swift?
  • There was problem loading requested app.it looks like you may be using LAN URL
  • Swift circular corners doesn't work properly on different screen sizes
  • How change .navigationBarTitle font in SwiftUI?
  • What happens if `MPSCNNConvolutionDataSource` protocol's `load` method return false?
  • Why does the UIBarButtonItem not show up when I create it with code?
  • How to prevent following view controller inheriting navigation view controller bar?
  • What does it mean when .xcodeproj files are shown in red in Xcode?
  • Xcode SwiftUI how to scroll the Preview Canvas?
  • Expand tableview and increase scrollview content size by an appropriate difference on clicking a button inside a table c
  • xcodebuild failed with return code: 65 - using CLI/Appcenter but no error messages
  • "'isDeveloperModeEnabled' is deprecated: This no longer needs to be set during development. " What is isDevelo
  • Right click in UIKit for Mac
  • How we Support Dark Mode in Current iOS App with iOS 13?
  • Security vulnerablility issue in ios mobile app
  • How to set a background color for the viewController in swiftUI?
  • SwiftUI : Segue navigation
  • iOS 13 Custom UISearchBar _searchField crash
  • USDZ models have holes in SceneKit but not QuickLook
  • Why does iOS Password Autofill not prompt to save password on keychain?
  • Pushing information to firebase after event is created(Firebase-Realtime-Database)
  • Xcode 11 Beta and Carthage bootstrap
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com