ios - Core animation (size change) with autolayout challenge -


i have piece of core animation use of 2 methods in order give appearance object growing in size centre-outwards existing location...

(1) viewdidlayoutsubviews()

self.imageview.frame = cgrectmake(187, 249, 0, 0)

which in centre of screen imageview object

(2) viewdidappear() - animation block of duration 1 second. e.g.

uiview.animatewithduration(1.0, delay: 1.5, options: [], animations: {          self.imageview.frame = cgrectmake(16, 70, 343, 358)          }, completion: nil) 

which puts object want show in full size, specific screen size.

when use x , y coordinates cgrectmake(...) on iphone size i'm looking work fine, when try on simulator different screen sizes, doesn't work in conjunction autolayout constraints, overrides existing constraints.

question(s)...

is there way of making animation work centering proportional screen size somehow, rather explicit coordinates , sizes? via cgrectmake...? (...which seems show clash between use of autolayout , animation)

ideally i'm looking elegant simple solution? or @ limits of tech?

many in advance!

you can set imageview location using autolayout constraints & give size constraint , taking outlet can animate height increase leaving other constraints working

@iboutlet var myviewheight: nslayoutconstraint!

uiview.animatewithduration(0.3, delay: 0.0, options: [], animations: { () -> void in

        self.myviewheight.constant = 300          self.view.layoutifneeded()         }, completion:nil) 

you should take outlet constraint control+drag on label.top = topmargin

you should take outlet constraint itself


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -