Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to add UINavigationController on top of UITabBarController with MonoTouch.Dialog

$
0
0

Hey All, Fairly new to IOS development, trying to do something that seems fairly simple. I want to create an app with a similar setup to figure 1-4 on the IOS developer library If I had the perfect scenario I would like to use DialogView to accomplish my tables with nav. So far I have a UITabBarController defined in my app delegate as you can see in this snippet.

    `public override bool FinishedLaunching (UIApplication app, NSDictionary options) 
    { 
        window = new UIWindow (UIScreen.MainScreen.Bounds);

        tabController = new TabController ();
        window.RootViewController = tabController;
        window.MakeKeyAndVisible ();

        return true;
    }

   public class TabController : UITabBarController 
{
    UIViewController tabHome, tabAnnouncements, tabMerchandise, tabContacts;

    public TabController ()
    {
        tabHome = new HomeScreen();
        tabHome.TabBarItem = new UITabBarItem ();
        tabHome.TabBarItem.Image = UIImage.FromFile ("icon-home.png");
        tabHome.TabBarItem.Title = "Home";

        tabAnnouncements = new NewsScreen();
        tabAnnouncements.TabBarItem = new UITabBarItem ();
        tabAnnouncements.TabBarItem.Image = UIImage.FromFile ("icon-news.png");
        tabAnnouncements.TabBarItem.BadgeValue = "3";
        tabAnnouncements.TabBarItem.Title = "News";

        tabMerchandise = new TestingDialog(); // this is a dialogviewcontroller
        tabMerchandise.TabBarItem = new UITabBarItem ();
        tabMerchandise.TabBarItem.Image = UIImage.FromFile ("xxx");
        tabMerchandise.TabBarItem.Title = "Merchandise";

        tabContacts = new ContactsScreen();
        tabContacts.TabBarItem = new UITabBarItem (UITabBarSystemItem.Contacts,0);
        var tabs = new UIViewController[] {
            tabHome, tabAnnouncements, tabMerchandise, tabContacts
        };

        ViewControllers = tabs;
    }


}`

How would I go about adding a dialogviewcontroller(with navigation) while maintaining the tabs on the bottom?

`public partial class PrScreen : UIViewController
{                
            public override void ViewDidLoad ()
    {
        base.ViewDidLoad ();

        _window = new UIWindow (UIScreen.MainScreen.Bounds);

        _rootElement = new RootElement ("xx") { 
            new Section ("xxx / xxx") 
        };

        _rootVC = new DialogViewController (_rootElement);

        _nav = new UINavigationController (_rootVC);

        foreach (xxx _pr in _xxxList) {
            var prElement = new RootElement (_pr.Description,2,0){
                new Section () {
                    new EntryElement ("Description: ","",_pr.Description)
                }
            };

            _rootElement [0].Add (prElement);
        }

        _window.RootViewController = _nav;

        _window.MakeKeyAndVisible ();


    }
        }`

The above code will just override the tab controller altogether

Help Much Appreciated!!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>