2676

CGAffineTransformMakeScale() distorting view frame after animation

I'm animating a view to make it appear as it is growing from the center of the screen with a theCGAffineTransformMakeScale(), it works fine in the iOS 8 beta 4 simulator but on the 7.1 version it distorts the frame of the view.

view.alpha = 0.0f; view.transform = CGAffineTransformMakeScale(0.95f, 0.95f); [UIView animateWithDuration:0.5f delay:0.0f usingSpringWithDamping:1.0f initialSpringVelocity:1 options:0 animations:^{ view.alpha = 1.0f; view.transform = CGAffineTransformMakeScale(1.0f, 1.0f); } completion:nil];

And it worked well in the last beta in both the iOS 8 and iOS 7.1 versions. Anyone else having this problem, the view is a table of a UINavigationControl.

Doing some tests it seems the transform is stretching the views frame instead of scaling it during the animation.

Upon further testing i found out that only transforms that makes the view smaller(1.0 to 0.9 for example) cause it to change its width, if the transform makes the view bigger (1.1 to 1.0) and then animates it to its current normal scale, the animation performs without problems.

Answer1:

You can sometimes get distortion when either the start or endpoint of the transformation has zero scale. Try setting your initial transform to something small but nonzero, e.g.

view.transform = CGAffineTransformMakeScale(0.01f, 0.01f);

Recommend

  • Passing vectors and params from Python to R functions
  • D3 V4 Hierarchical Edge Bundling port from v3
  • Linear-gradient works only with -moz vendor prefix
  • How to extract the values that return from the createRecognizeStream() method?
  • Selecting all tickers where price has increased by 5 percent within a time range
  • fade in an image in xcode automatically
  • Writing the results of Weka classifier to file in Java
  • Words falling from the top of screen in iphone
  • Is it possible to hide a UIToolbar with an animation?
  • Cluster unseen points using Spectral Clustering
  • CGAffineTransformMakeScale() distorting view frame after animation
  • How to write the quantile aggregate function?
  • iTextSharp - very large table memory leak
  • How Fade in UIButton
  • Set UITableView BackgroundColor Universally with UIAppearance
  • UITableViewCell change selectedBackgroundView alpha?
  • this class is not key value coding-compliant for the key PerformRotate
  • Custom font for MKAnnotationView Callout
  • How can I apply differnt styles when transforming data using json2html based on data value?
  • Implicit property animations do not work with CAReplicatorLayer?
  • Change the width of the JQM panels
  • limited threads in soapUI free version
  • What's a fast (non-loop) way to apply a dict to a ndarray (meaning use elements as keys and rep
  • UITableView takes much longer to load when numberOfRows returns a large number
  • Best practice for switching iPhone views?
  • Why I can't use uniform1f instead of uniform4f for setting a vec4 uniform?
  • Stitching 2 images (OpenCV)
  • How to resolve this packager error on react native Android
  • countdown bar android example
  • How to pass nginx proxy url for socket
  • How can I include If-None-Match header in HttpRequestMessage
  • Calculating ratio of reciprocated ties for each node in igraph
  • How to create CGPath from a SKSpriteNode in SWIFT
  • Installing PHP 7 on digitalocean
  • Generate random number from custom distribution
  • Problems installing Yesod for Haskell
  • Mysterious problem with floating point in LISP - time axis generation
  • Update CALayer sublayers immediately
  • Adding a button at the bottom of a table view
  • Array.prototype.includes - not transformed with babel