Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

NavigationRenderer > NavigationBar.Items empty on iOS7 (throws IndexOutOfBoundsException)

$
0
0

I'm accessing the navigation Item just fine in iOS8 but there isn't one in iOS7. I can't update the NavigationBar manually because it's controlled by the NavigationPage controller. Is this a xamarin thing or an iOS7 thing? Any idea how I get around this? Works great on iOS8

    public class MyNavigationPageRenderer : NavigationRenderer
    {
        UIBarButtonItem _savedLeftIconBarButtonItem;
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var navigationPage = (MyNavigationPage)Element;
            var navBar = this.NavigationBar;
            UINavigationItem item;
            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {

                item = navBar.Items[0];
            }
            else
            {
                // What do I do here???
                item = navBar.Items[0]; // crashes on 7.1
            }
       }
   }

Viewing all articles
Browse latest Browse all 58056

Trending Articles



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