0

ナビゲーション バーに編集ボタンを追加しようとしていますが、成功しません。アップルのドキュメントナビゲーションコントローラーで述べたような単純なタスクのようです。

myViewController.navigationItem.rightBarButtonItem = [myViewController editButtonItem];

私のコード:

- (void)viewDidLoad
{
    [super viewDidLoad];

 //   [self retrievePassengerInformation];

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
     self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

ここに画像の説明を入力

何らかの理由で編集ボタンが表示されません。これは静的にグループ化されたテーブルビューであることをお知らせします。

どんな助けでも大歓迎です。ありがとう、マルコス

4

2 に答える 2

0
UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editMethodName:)];
self.navigationItem.rightBarButtonItem = editButton;
于 2013-03-22T06:30:30.827 に答える
0

ViewController はナビゲーション コントローラーから呼び出されていないため、self.navigationItem にはアクセスできません。追加した UINavigationItem へのアウトレットを作成することになり、機能しています。

    @property (weak, nonatomic) IBOutlet UINavigationItem *addedNavigationItem;


- (void)viewDidLoad
{
    [super viewDidLoad];

 //   [self retrievePassengerInformation];

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.


    self.addedNavigationItem.rightBarButtonItem = self.editButtonItem;
}
于 2013-03-22T01:52:59.173 に答える