iphoneuinavigationcontrollerglobaluitoolbarmainwindow

iPhone Navigation-Based application - some global toolbar questions


I started iPhone development two months ago, so I can't call myself "expert" ;-) But I learned a lot in these two months, a lot here from stackoverflow :)
I'm working on an iPhone app which is based on the "Navigation-Based application" app template. My RootViewController is, of course, an UITableView. From that TableView, I can navigate to some views and one TableView.
I'm using a global toolbar, it's called in the RootViewController. Buttons are added to it in the view that needs the buttons.
Now, I have some questions regarding the use of the toolbar

  1. I insert a flexible space with that code:

    UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];

and a fixed space like this:

 UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:self action:nil];

My question: The flexible space is working, but how do I tell the fixed space which width it should have?

2. I noticed that my Todo-App "Things" uses a global toolbar with switching button sets. But in Things, there's some kind of fading effect when the button set is changing. How can I do that in my app?


Solution

  • To change the items on the toolbar and have it fade between the two sets, try this instance method of UIToolbar:

    - (void)setItems:(NSArray *)items animated:(BOOL)animated

    You basically keep the two sets of toolbar items in two arrays.