Hi,
I built that very simple UINavigationController subclass:
public class TweakedNavigationController : UINavigationController
{
public TweakedNavigationController(UIViewController rootViewController) : base(rootViewController)
{
}
public override void ViewDidLoad() // tried right into constructor, viewdidload and viewdidappear
{
base.ViewDidLoad();
// creating simple button
UIBarButtonItem barButtonItem = new UIBarButtonItem(
UIImage.FromBundle("first"),
UIBarButtonItemStyle.Plain,
(sender,args) => {
Console.Out.WriteLine("Oh sheet!");
}
);
// make sure we see it
barButtonItem.TintColor = UIColor.Black;
// add text
barButtonItem.Title = "Login";
// add to navigationitem
NavigationItem.SetRightBarButtonItem(barButtonItem, false);
}
}
This class is instantiated from a UIViewController like this:
public override void ViewDidLoad()
{
base.ViewDidLoad();
UIRefreshControl refreshControl = new UIRefreshControl();
refreshControl.ValueChanged += (object sender, EventArgs e) => {
GetPinsAndShowLoading();
};
TableViewController.RefreshControl = refreshControl;
TableViewController.RefreshControl.BeginRefreshing();
// creating instance of navigationcontroller
TweakedNavigationController = new TweakedNavigationController(TableViewController);
// add subview to view
Add(NavigationController.View);
GetPinsAndShowLoading();
}
I tried to run it from multiple places but I cannot wrap my head around why that button never get shown! Any ideas?
Thanks a lot and have a nice day