2013-11-27 108 views
0

我試圖展開容器視圖。但我無法弄清楚它所包含的元素爲什麼也沒有調整大小......他們保留着他們所擁有的基本大小。在動畫過程中調整容器視圖子視圖

這裏是我想什麼(告訴我,如果我做了什麼不好的,或者它可以做更容易)

[UIView animateWithDuration:1.5 
delay:0.0 usingSpringWithDamping:1 
initialSpringVelocity:0 
options:UIViewAnimationCurveLinear | UIViewAnimationOptionCurveLinear 
animations:^{ 
     _heightConstraint.constant = [[UIScreen mainScreen] bounds].size.height; 
     _widthConstraint.constant = [[UIScreen mainScreen] bounds].size.width; 
     _posYConstraint.constant = -20; 
     _posXConstaint.constant = 0; 
     // I tried desperately the following mess :) 
     for (UIView* i in _container.subviews) { 
      [i layoutIfNeeded]; 
     } 
     [_container layoutIfNeeded]; 
     [self.view layoutIfNeeded]; 
    } completion:nil]; 

回答

1

元素即子的觀點,如果你重新大小框不會改變。您需要更改視圖的變換,並將其應用於所有子視圖的變換。

<your view>.transform=CGAffineTransformMakeScale(2, 2); 
+0

的規模縮放每個元素,甚至文字的大小...我只是婉我的表視圖自動適應其容器的尺寸:( –

+0

然後動畫塊中手動設置表視圖的框架並在動畫後重新加載它。 – amar