Bug 13583 - Derived navigation controller is not loading xib controls
Summary: Derived navigation controller is not loading xib controls
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.4.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-07-29 19:20 UTC by drunkirishcoder
Modified: 2017-01-30 22:20 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
navigation controller (9.06 KB, application/zip)
2013-07-29 19:22 UTC, drunkirishcoder
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description drunkirishcoder 2013-07-29 19:20:54 UTC
I created a derived navigation controller with a xib file. Use the designer to create a button on the navigation bar and followed the steps to link the control to a variable. Run the application and button is null in C#.
Comment 1 drunkirishcoder 2013-07-29 19:22:51 UTC
Created attachment 4477 [details]
navigation controller
Comment 2 Vincent Dondain [MSFT] 2017-01-30 22:20:37 UTC
Hi,

So the problem here is that in the Xib there's no relation between the navigation controller and the view controller.

It might be possible to have both the navigation controller and the view controller inside the same xib but honestly but that's a. not recommended by Apple, b. not how xibs should be used (more of a single view/controller type of thing).

All the examples you will find that use Xibs and navigation controllers will have a NavigationController set in code:

In your AppDelegate you'd do this:

```
// Initialize the UINavigationController with a custom ViewController directly
// (that's the missing link that your Xib is not doing, hence why you can't see the button item)
var navigationController = new UINavigationController (new MyViewController ());

window.RootViewController = navigationController;
```

However in general, especially since it's now 2017, I'd recommend using storyboard for navigation controller (;

In storyboards it's totally fine to have multiple view controllers and segues are the way to link one to another.

See: https://developer.xamarin.com/guides/ios/user_interface/introduction_to_storyboards/

Also the Master-Detail default iOS template is a good start.

You might also be able to get more informations in our forums: https://forums.xamarin.com/categories/ios

This is not a bug with Xamarin.iOS though so I'm closing it.

Thanks.