views:

419

answers:

1

is it possible to balance the position of button(example toolbar in Safari)?

    UIBarButtonItem *infoButton = [[UIBarButtonItem alloc] 
                                       initWithBarButtonSystemItem:UIBarButtonSystemItemCompose 
                                       target:self action:@selector(support:)];

        UIBarButtonItem *next = [[UIBarButtonItem alloc] 
                                       initWithBarButtonSystemItem:UIBarButtonSystemItemPlay 
                                       target:self action:@selector(support:)];
        [self.navigationController.toolbar setItems:[NSArray arrayWithObjects:infoButton, next,nil] animated:YES];

alt text

+1  A: 

You need to add a flexible space item between the two button items.

More detail is available in Apple's UICatalog sample code. e.g.:

// flex item used to separate the left groups items and right grouped items
UIBarButtonItem *flexItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
                                                                          target:nil
                                                                          action:nil];
Shaggy Frog
thanks Shaggy Frog let me try
RAGOpoR
can i ask more question?is it possible to disable item of self.navigationController.toolbarthanks
RAGOpoR
You should ask a separate question, and try to make the question as complete as possible.
Shaggy Frog