iphone - Scaling a UIView during transitionFromView? -
i'm using container uiview replicate kind of behavior itunes store when tap on album artwork , flips , scales.
current code looks like:
//mainview 300x300x, smallview 30x30 [uiview beginanimations:nil context:nil]; [uiview setanimationduration:2.0]; [uiview transitionfromview:mainview toview:smallview duration:3.0 options:uiviewanimationoptiontransitionflipfromleft completion:nil]; containerview.frame = cgrectmake(275, 415, 30, 30); [uiview commitanimations]; i can't seem content of containerview scale during animation, frame closes in on content. tried applying transforms both view , layers , bunch of other things can't seem behave properly.
rather setting frame, try using transform instead:
- (void)setstarttransform:(cgaffinetransform)transform; - (void)setendtransform:(cgaffinetransform)transform; something like
[uiview beginanimations:nil context:nil]; [uiview setanimationduration:2.0]; [uiview transitionfromview:mainview toview:smallview duration:3.0 options:uiviewanimationoptiontransitionflipfromleft completion:nil]; //containerview.frame = cgrectmake(275, 415, 30, 30); [containerview setstarttransform: cgaffinetransformidentity]; [containerview setendtransform: cgaffinetransformmakescale(0.1, 0.1)]; [uiview commitanimations]; (you might need apply translate transform too.)
Comments
Post a Comment