1

私のアプリでは、ナビゲーション バーで 2 つの UIBarButtonItem を追加しました。iOS6以下ではこんな感じここに画像の説明を入力

しかし、iOS7でアプリを実行すると、次のようになります ここに画像の説明を入力

問題は次のとおりです。更新ボタンがダウンします。それで、「今日」ボタンと同じ更新ボタンを表示するのを手伝ってください。以下は私が使用しているコードです、

 UIBarButtonItem* todayButton = [[UIBarButtonItem alloc] initWithTitle:@"Today"
                                                                style:UIBarButtonItemStyleBordered 
                                                               target:self
                                                               action:@selector(showTodayAction:)];
UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                                              target:self
                                                                              action:@selector(refreshAction:)];
refreshButton.style = UIBarButtonItemStyleBordered;

    UIBarButtonItem *negativeSeperator = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
                                                                                       target:nil
                                                                                       action:nil];
    negativeSeperator.width = -12;

    TransparentToolbar *toolbar = [[TransparentToolbar alloc] initWithFrame:CGRectMake(0, -5, 100, TOOLBAR_HEIGHT)];
    toolbar.items = [NSArray arrayWithObjects:
                     negativeSeperator,
                     refreshButton, todayButton,
                     negativeSeperator,
                     nil];

    UIView *toolbarView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, TOOLBAR_HEIGHT)];
    [toolbarView addSubview:toolbar];

    UIBarButtonItem *toolbarItem = [[UIBarButtonItem alloc] initWithCustomView:toolbarView];

    self.navigationItem.leftBarButtonItem = toolbarItem;
4

2 に答える 2

0

このようにしてください....申し訳ありませんが急いでいます

プラグマは試行をマークします

UIBarButtonItem* todayButton = [[UIBarButtonItem alloc] initWithTitle:@"Today"
                                                                style:UIBarButtonSystemItemRefresh
                                                               target:self
                                                               action:@selector(goBack)];
UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                                               target:self
                                                                               action:@selector(goBack)];
refreshButton.style = UIBarButtonItemStyleBordered;

UIBarButtonItem *negativeSeperator = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
                                                                                   target:nil
                                                                                   action:nil];
negativeSeperator.width = -12;

UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];
toolbar.items = [NSArray arrayWithObjects:
                 
                 negativeSeperator,refreshButton, todayButton,
                 negativeSeperator,
                 nil];//
 self.navigationItem.leftBarButtonItems = toolbar.items;
于 2013-10-10T12:32:34.830 に答える