Titolo dell'articolo di Barbutton nella barra degli strumenti visibile su iOS 6 ma non su iOS 7

StackOverflow https://stackoverflow.com//questions/24002255

  •  20-12-2019
  •  | 
  •  

Domanda

Sto usando il seguente codice per la barra degli strumenti e mostra il titolo per iOS 6 ma non Fro IOS 7.

UIBarButtonItem *settingButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"multimedia/icon_settings.png"] style:UIBarButtonItemStylePlain                                                                  target:self                                                                 action:@selector(pressSettings:)];
UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"multimedia/icon_refresh.png"]                                                                style:UIBarButtonItemStylePlain target:self                                                                 action:@selector(pressRefresh:)];
UIBarButtonItem *helpButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"multimedia/icon_help.png"]                                                                  style:UIBarButtonItemStylePlain target:self action:@selector(pressHelp:)];
UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];

/* Set the title of the button */
[settingButton setTitle:@"Settings"];
[refreshButton setTitle:@"Refresh"];
[helpButton setTitle:@"Help"];
[feedbackButton setTitle:@"Feedback"];

NSArray *toolbarButtons = @[settingButton, flexSpace, helpButton, flexSpace, feedbackButton, flexSpace, refreshButton];

[self setToolbarItems:toolbarButtons];
.

Questo codice funziona bene con iOS 6 ma mostra solo il pulsante a barre dell'immagine in iOS 7 non titolo.

È stato utile?

Soluzione

L'UINAVISIONCONTROLLER mantiene una barra di uolool per ogni controller di visualizzazione nella sua pila.Questa barra degli strumenti è normalmente nascosta.Quindi, è necessario mostrare esplicitamente la barra degli strumenti:

[self.navController setToolbarHidden:NO];
.

Ottieni il controller di navigazione del tuo viewController e impostare la proprietà SETTOOLOOL BARHENDENDEND sopra in no.

Spero che ti aiuti.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top