1

ボタンの位置のバランスを取ることはできますか (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];

代替テキスト

4

1 に答える 1

7

2 つのボタン アイテムの間にフレキシブル スペース アイテムを追加する必要があります。

詳細については、Apple のUICatalog サンプル コードを参照してください。例えば:

// flex item used to separate the left groups items and right grouped items
UIBarButtonItem *flexItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
                                                                          target:nil
                                                                          action:nil];
于 2010-03-12T06:51:37.050 に答える