2016-04-12 49 views
0

以下代碼將破壞框架(這將是巨大的),如iOS 8.1.3中所示。將變換視圖添加到UIWindow或UIView後出現錯誤框架

someView.layer.transform = CGAffineTransformMakeScale(0.001f, 0.001f); 
[[[[UIApplication sharedApplication] keyWindow].subviews lastObject] addSubview:someView]; 

[UIView animateWithDuration:0.3f animations:^{ 
    someView.transform = CATransform3DIdentity; 
}]; 

刪除轉換並將其替換爲簡單的幀移動動畫效果很好。爲什麼?

回答

0

經過一番調查和推理後,我得出的結論是,將之後的someView 轉換爲視圖可能是個好主意。這原來是解決方案。所以我們寫道:

[[[[UIApplication sharedApplication] keyWindow].subviews lastObject] addSubview:someView]; 
someView.layer.transform = CGAffineTransformMakeScale(0.001f, 0.001f); 

[UIView animateWithDuration:0.3f animations:^{ 
    someView.transform = CGAffineTransformIdentity; 
}]; 

它按預期工作。

相關問題