2012-11-23 92 views
0

我正在使用塊的動畫,並試圖動畫更改我的主窗口的框架。 這裏是我的代碼:動畫self.view.window.frame更改

[UIView animateWithDuration:0.3f animations:^{ 
      [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
      self.view.window.frame = CGRectMake(0.0f, -20.0f, self.view.window.frame.size.width, self.view.window.frame.size.height+20); 
}]; 

但是它並不像動畫改變self.view.frame或別的東西。這只是簡單的廢話,沒有動畫。

任何想法?

回答

1

這是錯誤的,窗口在框架和邊界固定, 你不能移動窗口,其頂部根容器,具有一定的大小,你應該翻譯和轉換您的觀點僅是這樣的。

[UIView animateWithDuration:0.3f animations:^{ 
      [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
      self.view.frame = CGRectMake(0.0f, -20.0f, self.view.frame.size.width, self.view.frame.size.height+20); 
}]; 
+0

它不起作用。我想要的是重寫狀態欄。只有改變窗口框架的作品! – Devfly