开发者

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开发者_Python百科 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?


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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜