我的意圖是創建一個新的視圖控制器與當前控制器視圖的一些控件(按鈕,標籤等)。如何複製UIView到另一個
//Get all the controls
NSArray* array =[[NSArray alloc]init];
array=[self.view subviews];
for(int i =0 ;i<array.count ;i++)
{
// UIView *subview = (UIView *)[array objectAtIndex:i];
UIView *subview = (UIView *)[array objectAtIndex:i] ;
..
[nextview.view insertSubview:subview atIndex:i];
}
但是我發現當新viewcontroller視圖關閉父控件的所有控件也disappering。我如何將UIView *對象複製到另一個?
嘗試重新使用該視圖,如果你可以 – Felix 2012-08-17 09:18:12
你也可以檢查[這篇文章](http://stackoverflow.com/questions/4425939/can-uiview-be-copied)爲解決方案使用NSKeyedUnarchiver '/'NSKeyedArchiver'。 – 2014-03-09 10:13:00