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

  • Awesomesauce Network

    Awesomesauce

    4 EKİM 2012
  • MrChiCity3

    MrChiCity3

    14 NİSAN 2008
  • The Brister

    The Brister

    10 ŞUBAT 2008