views:

849

answers:

3

Hi,

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 (like in that tutorial). 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?

Thank you in advance ;-)

+3  A: 

The docs say:

UIBarButtonSystemItemFixedSpace

Blank space to add between other items. Only the width property is used when this value is set.

Set the item's width property.

NSResponder
A: 

Thanks, it's working now :-)
So, question 1 is solved. Answers to question 2 are still welcome ;-)

Yassin
You can edit your own question rather than adding replies as an answer.
Cannonade
Thanks, I'm going to do that in the future.
Yassin
+1  A: 

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.

No Surprises
Thanks a lot - it's working now.
Yassin