UITabBarController
은 5 UINavigationControllers
입니다 (N1 - N5라고 부름). UINavigationControllers
에는 UITableViewController가 네비게이션 스택에 푸시되도록 UI 요소가 있습니다.이 두 가지를 구현하려면 MonoTouch.Dialog
DialogViewController
을 사용합니다. UITableViewControllers
). T1 ~ T5라고 부르 자.ViewDid 뒤로 탐색 할 때 UINavigationController에 호출되지 않을 때
탭 사이를 탐색 할 때 각각 N1 - N5에서 예상대로 ViewDidAppear
메서드가 호출됩니다. 하지만 N1의 UI 요소를 터치하면 T1이 탐색 스택에 푸시되고 다시 버튼을 사용하여 되돌아 가려고하면 N1의 ViewDidAppear
메서드가 호출되지 않습니다.
재미있는 점은 다른 탭 (예 : N2)으로 탭 오버 한 다음 N1에 "탭 백"하면 ViewDidAppear
이 정상적으로 호출된다는 것입니다. 그리고 만약에 T1이 nav 스택에 푸쉬되었다고해도, 같은 탭핑을하면 N1의 ViewDidAppear
이 여전히 호출됩니다.
N1의 MonoTouch
코드는 다음과 같습니다 : 나는 무슨 일이 있었는지 알아 냈
public class CalendarPage : UINavigationController
{
private DialogViewController dvc;
public override void ViewDidAppear (bool animated)
{
// initialize controls
var now = DateTime.Today;
var root = new RootElement("Calendar")
{
from it in App.ViewModel.Items
where it.Due != null && it.Due >= now
orderby it.Due ascending
group it by it.Due into g
select new Section (((DateTime) g.Key).ToString("d"))
{
from hs in g
select (Element) new StringElement (((DateTime) hs.Due).ToString("d"),
delegate
{
ItemPage itemPage = new ItemPage(this, hs);
itemPage.PushViewController();
})
{
Value = hs.Name
}
}
};
if (dvc == null)
{
// create and push the dialog view onto the nav stack
dvc = new DialogViewController(UITableViewStyle.Plain, root);
dvc.NavigationItem.HidesBackButton = true;
dvc.Title = NSBundle.MainBundle.LocalizedString ("Calendar", "Calendar");
this.PushViewController(dvc, false);
}
else
{
// refresh the dialog view controller with the new root
var oldroot = dvc.Root;
dvc.Root = root;
oldroot.Dispose();
dvc.ReloadData();
}
base.ViewDidAppear (animated);
}
}