2014-02-11 34 views
0

我正在嘗試調整在Storyboard中創建的列的大小。我在這個新的,現在我得到這樣的:iOS - 動畫調整一個座標軸中的對象

- (void)viewDidAppear:(BOOL)animated 
{ 
    [super viewDidAppear:animated]; 

    [UIView animateWithDuration:2.0 
          delay:0.0 
         options: UIViewAnimationOptionCurveLinear 
        animations:^{ 
         CGAffineTransform scaleTrans = CGAffineTransformMakeScale(1, 6); 
         CGAffineTransform moveTrans = CGAffineTransformMakeTranslation(0, -200.0); 
         MyColumn.transform = CGAffineTransformConcat(scaleTrans, 
                      moveTrans); 
        } 
        completion:nil]; 
} 

它正在改變的對象,並在年底它看起來不錯(這也正是最初的對象開始,用6倍大的高度)。問題是:

  • 動畫不是從對象開始,而是在屏幕底部的某處。
  • 我想有選項來設置精確的柱高度尺寸,並有選項可以從0高度(現在我已20的高度進行測試)

我知道開始,如果我想解決我shoudn第二個問題't使用縮放變換,但我試過這些:

[UIView animateWithDuration:3.0 
        delay:0.0 
        options: UIViewAnimationOptionCurveLinear 
        animations:^{ 
         MyColumn.bounds = CGRectMake(150, 150, 150, 150); 
        } 
        completion:nil]; 

[UIView animateWithDuration:3.0 
        animations:^{ 
         CGRect theFrame = AnswerAColumn.frame; 
         theFrame.size.width += 50.f; 
         MyColumn.frame = theFrame; 
        }]; 

我只是無法得到它的工作(它不會改變任何東西)。我究竟做錯了什麼?感謝您的幫助

回答

0

您是否嘗試過將CGAffineTransform設置爲動畫塊,然後將其設置在塊內部?

+0

它沒有改變任何東西。它和以前一樣工作。 –