Skip to content

Instantly share code, notes, and snippets.

@danmiser
Last active August 29, 2015 14:08
Show Gist options
  • Save danmiser/9894a60b8f43f0401265 to your computer and use it in GitHub Desktop.
Save danmiser/9894a60b8f43f0401265 to your computer and use it in GitHub Desktop.
MonoTouch iOS8 not calling LoadView
// Recreate the home screen menu in case things have changed since the last sync
AppDelegate delegateReference = (AppDelegate)UIApplication.SharedApplication.Delegate;
// This if should always be true. Just being defensive to prevent crash shutdown if it's not
var viewControllers = delegateReference.rootNavigationController.ViewControllers;
if (viewControllers != null && viewControllers[0] is HomeScreen)
{
var homeScreen = (HomeScreen)viewControllers[0];
homeScreen.Root = homeScreen.CreateRoot();
// This line of code is needed in iOS8. It ends up triggering LoadView()
// Without it, the Reload will end up with a null TableView and crash
var view = homeScreen.View;
homeScreen.Root.Reload(homeScreen.rootSection, UITableViewRowAnimation.None);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment