2013-05-02 31 views
-1

我的問題是這樣的:[presentViewController:B]但我想看到A的視圖。 我是這樣的問題的解決方案。在A(UIViewController)presentViewController後看到視圖(A.view):B(UIViewController)

換句話說,我想要一個獨特的UIWindow圖片。

UIWindow *_applicationWindow = [[[UIApplication sharedApplication] delegate] window]; 
UIGraphicsBeginImageContext(_applicationWindow.bounds.size); 
CGContextRef ctx = UIGraphicsGetCurrentContext(); 
[_applicationWindow.layer renderInContext:ctx]; 
UIImage *imageTemp = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext(); 
UIImageView *_imageView = [[[UIImageView alloc] init] autorelease]; 
_imageView.image = imageTemp; 
[B.veiw addSubview:_imageView]; 

但_imageView不明顯。

感謝。

+1

請在你正在做的事情中更具描述性...... – 2013-05-02 03:28:21

+0

我想從UIWindow得到一個清晰的圖片 – huqinghe 2013-05-02 04:18:38

回答

0

我不是100%肯定,我明白你的問題,但我會試試看

當在iPhone上它呈現視圖控制器將覆蓋整個屏幕。在iPad上,您可以設置UIModalPresentationPageSheet或UIModalPresentationFormSheet。

要在iPhone上顯示多於1個視圖控制器(或者在UIModalPresentationPageSheet或UIModalPresentationFormSheet可以提供的其他演示模式下),您必須使用iOS 5中引入的稱爲視圖控制器遏制的內容。

你將不得不在尋找的方法是:

addChildViewController: 
removeFromParentViewController 
willMoveToParentViewController: 
didMoveToParentViewController: 
在UIViewController中

+0

謝謝,我試了一下。 – huqinghe 2013-05-02 03:48:54

+0

它是怎麼回事?成功的? – Erik 2013-05-03 07:13:27

+0

addChildViewController:謝謝。 – huqinghe 2013-05-06 05:46:39

相關問題