0
在我Xamarin iOS應用後,我打開ContactUI用下面的代碼:IOS ContactUI導航回到應用程序編輯
var contact = new AddressBookService().GetCNContactById(addressbookId);
var view = CNContactViewController.FromNewContact(contact);
view.Editing = true;
// Display the view
var window = UIApplication.SharedApplication.KeyWindow;
var vc = window.RootViewController;
while (vc.PresentedViewController != null)
{
vc = vc.PresentedViewController;
}
var navController = vc as UINavigationController;
if (navController != null)
{
vc = navController.ViewControllers.Last();
}
vc.PresentViewController(new UINavigationController(view), true, null);
我把它包在一個INavigationController
,因爲沒有它不會加載。有下面的消息打印到輸出:
[CNUI ERROR] Contact view delayed appearance timed out
編輯對話框顯示正確。但經過我點擊Save我來詳細查看:
正如你看到的是第二個問題,沒有後退按鈕。所以回到我的應用程序的唯一方法是殺死應用程序,然後重新開始。 在我保存聯繫人之後,是否可以直接導航回我的應用程序?或者在我的當前ViewController中包裝ContactUI,以便TabBar
在下面仍然可見?