I am using the overlay code from here - http://docs.xamarin.com/recipes/ios/standard_controls/popovers/display_a_loading_message
It worked all fine..., I was able to call View.Add(loadingOverlay)
...until I changed things to MonoTouch.Dialog and it doesn't work anymore.
public partial class BaseView : UIViewController
{
LoadingOverlay loadingOverlay;
public void ProgressDialogShow(string message, string title)
{
loadingOverlay = new LoadingOverlay(message, UIScreen.MainScreen.Bounds);
View.Add(loadingOverlay);
}
}
And the View itself (the LoginView) is inheriting from BaseView.
[Register("SecondLoginView")]
public class SecondLoginView : BaseView
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
window = new UIWindow(UIScreen.MainScreen.Bounds);
root = new RootElement("Login") {
new Section() {
new EntryElement ("Benutzer", "Login", "Test")
}
};
rootVC = new DialogViewController(root);
nav = new UINavigationController(rootVC);
window.RootViewController = nav;
window.MakeKeyAndVisible();
}
}
In that case, the Loadingoverlay is not showing up. How can I still use it with MonoTouch.Dialog?
Any help appreciated!
Slack Shot is on the right track. The reason you are having issues is because you are structuring your application strangely. You should not have the
window.MakeKeyAndVisible
orwindow.RootViewController
assignments in yourSecondLoginView
class.You can add your
rootVC
as a subview like this:V
iew.Add(rootVC.View);
I am sure you can do it some way with the code you have, but the way I always use a
DialogViewController
(if its the only view meant to be on the screen) I inherit directly from it. If you want to provide some common overlay code, make your BaseView aDialogViewController
and inherit that.You should remove this code from the view controller:
If you want to make your controller in a
nav
, do it wherever you create SecondViewController. In your case, it might be in the storyboard file.