UIBarButtonItem не работает - PullRequest
       2

UIBarButtonItem не работает

0 голосов
/ 12 октября 2010

Я изменяю заголовок UIBarButtonItem во время выполнения, но он не работает

if(self.toolbarItems!=nil)
    {
        NSArray *toolbaritem=self.toolbarItems;
        UIBarButtonItem* tmpeditButton =[toolbaritem objectAtIndex:0];
        tmpeditButton.title=@"Done";
        NSLog(@"log %@",tmpeditButton.title);
    }

В журнале всегда отображается значение NULL. Почему и как это исправить?

1 Ответ

1 голос
/ 12 октября 2010

Используйте это

UIBarButtonItem *barButton = [[UIBarButtonItem  alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain target:self action:nil];
...