Hi,

I have been trying to work out the best way to layout my navigation through my 
application, I hit a number of issues on the way, here is a mock up of what I 
am trying to achieve.

http://i49.tinypic.com/2zi95ps.png

the important bits are that the images on the top buttons have no borders, the 
whole screen is capable of being coloured in what ever style the client 
requires, so the use of tint colours and background colours is important. To 
get this to work properly I had to do the following, the top is 3 toolbars one 
for the left button, one for the right button and one for the title, I could 
not find a way to get this to work any other way.

The bottom is a toolbar as well, the main reason is to get the layouts to work 
and being able to colourise the selected icon with a tint colour.

Is there a better way??

With the above approach I thought I would create one controller and subclass 
it, but I ran into a number of issues with set selector not set errors that I 
could not solve, so then I decided to just create the 5 main screens in IB and 
wire it all up, well that did not work, IB kept on crashing and loosing my 
outlets, so gave up on that idea. So my final way which I think is the best way 
is to create the controls in code, I have looked a lots of examples and my code 
just won't run.

the simplest of examples.

public override void ViewDidLoad() {
        base.ViewDidLoad();
        _tintColour = UIColor.FromRGB(80,80,80);
        _tintHighColour = UIColor.FromRGB(255,255,0);
        _tbBikeLists = new UIBarButtonItem();
        //_tbBikeLists.Image("Images/Toolbar/Bike.png");
        _tbBikeLists.Style = UIBarButtonItemStyle.Plain;
        _tbBikeLists.TintColor = _tintColour;
        _toolBar = new UIToolbar();
        _toolBar.Bounds.X = 0;
        _toolBar.Bounds.Y = 416;
        _toolBar.Bounds.Width = 320;
        _toolBar.Bounds.Height = 44;
        _toolBar.BackgroundColor = _tintColour;
        _toolBar.BarStyle = UIBarStyle.Default;
        UIBarButtonItem[] ToolbarItems = new UIBarButtonItem[] {_tbBikeLists};
                        
        // all the issues seem to be down here
        this.SetToolbarItems(ToolbarItems,true);
        this.NavigationController.ToolbarHidden = false; <--- bombs out on this 
line with  System.NullReferenceException: Object reference not set to an 
instance of an object
        this.NavigationController.SetToolbarItems(ToolbarItems, true);

I am sure it is something simple that I am missing.

thanks for any help.

atb

alex
 
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to