2011-10-30 60 views
1

我目前有一個子視圖覆蓋整個屏幕和一個UIButton。當我按下按鈕時,我提出了一個使用[self presentModalViewController:controller animated:YES];發送電子郵件的不同視圖,它引發了新視圖(視圖控制器),但在子視圖後面。如果我按下一個按鈕到removeFromSuperview和子視圖消失,那麼電子郵件視圖控制器是可見的。如何在子視圖上顯示ModalViewController

當使用presentModalViewController時可以設置Z索引嗎?

我不想在子幻燈片上移之前刪除子視圖。我希望它在用戶輸入他的電子郵件等的整個過程中保持在那裏。因此,當他完成時,子視圖仍然顯示。


顯示子視圖(其具有上的按鈕)

[self.view.superview addSubview:pinSpecsView]; 

點擊按鈕

UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"Share" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Email", @"Message", nil]; 
popupQuery.actionSheetStyle = UIActionSheetStyleDefault; 
[popupQuery showInView:self.view]; 
[popupQuery release]; 

顯示電子郵件控制器 「電子郵件」 之後被選擇

MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init]; 
    controller.mailComposeDelegate = self; 
    .... 
    [self presentModalViewController:controller animated:YES]; 

回答

1

我想你應該添加pinSpecsView到self.view而不是self.view.superview。

[self.view addSubview:pinSpecsView]; 

要更改子視圖的Z順序,請使用sendSubviewToBack:bringSubviewToFront:methods。

+0

哈哈,我現在看到它很明顯 - 在superview之上添加視圖。感謝您指出! – LouwHopley

相關問題