Titre de l'article Barbutton dans la barre d'outils visible sur iOS 6 mais pas sur iOS 7

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

  •  20-12-2019
  •  | 
  •  

Question

J'utilise le code ci-dessous pour la barre d'outils et il affiche le titre pour iOS 6 mais pas 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];

Ce code fonctionne bien avec iOS 6 mais ne montre que l'image de bouton de barre dans iOS 7 pas titre.

Était-ce utile?

La solution

L'UINAVIGATIONCONTROLLER maintient un uitoolbar pour chaque contrôleur d'affichage dans sa pile.Cette barre d'outils est normalement cachée.Donc, vous devez montrer explicitement la barre d'outils:

[self.navController setToolbarHidden:NO];

Obtenez le contrôleur de navigation de votre ViewController et définissez la propriété ci-dessus SetoLLDBarChiddene sur NO.

J'espère que ça vous aide.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top