UIDynamicItem update transform manually

Viewed 2279

I know that external change to center, bounds and transform will be ignored after UIDynamicItems init.

But I need to manually change the transform of UIView that in UIDynamicAnimator system.

Every time I change the transform, it will be covered at once.

So any idea? Thanks.

3 Answers

Another way to fix this (I think we should call it bug) is to override the transform property of the UIView used. Something like this:

override var transform: CGAffineTransform {
    set (value) {

    }
    get {
        return super.transform
    }
}

var ownTransform: CGAffineTransform. {
    didSet {
        super.transform = ownTransform
    }
}

It's a kind of a hack, but it works fine, if you don't use rotation in UIKitDynamics.

Related