1

I want to show a modal view when I tap on a section of my UITabBarController or maybe an uipopoverbackgroundview like the one that is included in the GroupMe application. (image included for reference).

http://wpuploads.appadvice.com/wp-content/uploads/2011/09/groupme-iphone-app-300x452-199x300.jpg

Do you know a way to get this in monotouch instead the standard loading of a navcontroller with a view controller?

... and now I have an additional complication because I cannot use the "put a decorated button on top of the tabbar" workaround because the option is the number 7 in my tabbar so it appears on the "More" section of the control ... any help will be greatly appreciated.

JMGH
  • 234
  • 4
  • 12

1 Answers1

0

I kind of implemented something like this using the popover and Dialog.

I have a barbuttonitem that when pressed pops up with a dropdown list to allow you to select between different companies. myPopController is a class level variable and then the lambda expression inside the string element redirects to a specific function.

Code below

void HandleBtnCompanyhandleClicked (object sender, EventArgs e)
    {

        if(myPopController != null)
        {
            myPopController.Dismiss(true);
            myPopController.Dispose();
        }

        //create the view
        UIView contentView = new UIView();
        contentView.Frame = new RectangleF(new PointF(0,0), new SizeF(320f, 240f));
        //create the view controller
        UIViewController vc = new UIViewController();
        vc.Add(contentView);
        //set the popupcontroller
        myPopController = new UIPopoverController(vc);
        myPopController.PopoverContentSize = new SizeF(320f, 240f);

        //Add the elements to the rootelement for the companies
        // TODO: change to a DB read eventually
        RootElement rt = new RootElement(""){
            new Section ("Requests") {
                new StringElement ("ABC Company",() => {companyTapped("ABC Company");}),
                new StringElement ("Northwind", () => {companyTapped("Northwind");}),
                new StringElement ("Initrode", () => {companyTapped("Initrode");}),
                new StringElement ("Foo Bars Group", () => {companyTapped("Foo Bars Group");}),
                new StringElement ("Widget Corp", () => {companyTapped("Widget Corp");}),
            }
        };

        //create the DVC and add to the popup
        DialogViewController dvc = new DialogViewController(rt);
        contentView.AddSubview(dvc.View);
        myPopController.PresentFromBarButtonItem(btnCompany,UIPopoverArrowDirection.Up,true);
    }
Jabsy
  • 171
  • 4
  • 16