Permalink
Browse files

Improvements to Demo's "animate changes" logic.

  • Loading branch information...
1 parent 2108af0 commit 903e0652debd554fa7885bd6344858ab2ae76090 @charlesmchen committed Feb 23, 2012
@@ -308,13 +308,17 @@ - (void) animateRelayout:(UIView*) view {
dstFrames[i] = view.frame;
// Restore old frame.
- CGRect restoreFrame = view.frame;
- restoreFrame.origin = srcFrames[i].origin;
- if ([views respondsToSelector:@selector(setFrameWithoutLayout:)]) {
- WePanel* frame = (WePanel*) view;
- [frame setFrameWithoutLayout:restoreFrame];
- } else {
- view.frame = restoreFrame;
+ if ([view.subviews count] < 1) {
+ view.frame = srcFrames[i];
+ } else {
+ CGRect restoreFrame = view.frame;
+ restoreFrame.origin = srcFrames[i].origin;
+ if ([views respondsToSelector:@selector(setFrameWithoutLayout:)]) {
+ WePanel* frame = (WePanel*) view;
+ [frame setFrameWithoutLayout:restoreFrame];
+ } else {
+ view.frame = restoreFrame;
+ }
}
// if ([views isKindOfClass:[WePanel class]]) {

0 comments on commit 903e065

Please sign in to comment.