Navigation Page in Tabbed Page

public class mainNav : TabbedPage { public mainNav () { Children.Add(new NavigationPage (new Page1 ()) { Title = "1", BarBackgroundColor = Color.FromRgb (255, 69, 0), BarTextColor = Color.White, }); Children.Add(new NavigationPage (new Page2 ()) { Title = "2", BarBackgroundColor = Color.FromRgb (255, 69, 0), BarTextColor = Color.White, }); Children.Add(new NavigationPage (new Page3 ()) { Title = "3", BarBackgroundColor = Color.FromRgb (255, 69, 0), BarTextColor = Color.White, }); Children.Add(new NavigationPage (new Page4 ()) { Title = "4", BarBackgroundColor = Color.FromRgb (255, 69, 0), BarTextColor = Color.White, }); } }

As I build them, It worked on Android. But on iOS, it doesn't work. Are there anything to do I missed?

Posts

  • IvanHarrisIvanHarris USMember ✭✭✭

    I had the same issue. The solution for me is to rebuild the PCL project, rebuild the ios project, then run the app. It should display it now.

    For some reason each change I make (either in PCL or ios project), I have to rebuild the project I just edited and then I see the changes within the app. annoying, but I did the whole app in android first so now its just cleaning up interface and dependencies to work with ios project. I started yesterday (with ios) and should be done with the ios project today. I LOVE Xamarin.Forms! :smile:

    A couple of things that got me was:

    1. within my App class (wtihin the PCL project), my navigation code was breaking the app. you should have

      var main = new NavigationPage(new Main());
      return main;

    2. make sure any icons that are used in the android app is also within the Resources folder within the ios project and properly named with regards to the icon name.

      ToolbarItem deleteItem = new ToolbarItem
      {
      Name = "Delete",
      Icon = Device.OnPlatform("delete.png", "ic_action_discard.png", "Images/delete.png"),
      Order = ToolbarItemOrder.Primary
      };

    3. I personally must rebuild the PCL or ios project(s) that I edit before I run the app to debug.

    4. This didnt get me but maybe someone will see this and it will help. In VS (dont know about XamarinStudio) you must select the ios project as the startup project (right click ios project, click on 'Set as StartUp Project'
    5. Make sure your targeted ios simulator is installed on your Apple machine. I run a Mac VM. To know whats installed, I open up Xamarin Studio and click the dropdown to see whats installed.

    Edit: I can never get the code to show properly here. Sorry for ugly format, but its a small amount of code.

  • AtsuyaUchidaAtsuyaUchida JPMember ✭✭

    Sorry for I took long to reply. I tried them and updated Xamarin Studio to Beta channel, but It didn't work. After I tried to update and remove Navigation Page, It worked on iOS. according to discussion about Xamarin 1.3.0, it looks like fixed (maybe that was due to bug of Xamarin 1.2.9.x). I appreciate your kind help.

Sign In or Register to comment.