SORU
23 Mart 2010, Salı


Nasıl UİNavigationBar için bir düğme eklemek için?

Nasıl programlı olarak UİNavigationBar için bir düğme eklemek için?

CEVAP
23 Mart 2010, Salı


Örnek kod, bir gezinti çubuğu üzerinde sağ düğme ayarlamak için.

UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" 
    style:UIBarButtonItemStyleDone target:nil action:nil];
UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@"Title"];
item.rightBarButtonItem = rightButton;
item.hidesBackButton = YES;
[bar pushNavigationItem:item animated:NO];

Ama normal bir navigasyon denetleyicisi, yazmak için etkinleştirilmesi gerekir:

UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done"
    style:UIBarButtonItemStyleDone target:nil action:nil];
self.navigationItem.rightBarButtonItem = rightButton;

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • JayzTwoCents

    JayzTwoCents

    26 AĞUSTOS 2012
  • MatheusDosGames

    MatheusDosGa

    28 Aralık 2011
  • New Challenger - Game Reviews

    New Challeng

    20 Temmuz 2006