0

別のViewControllerのページカールが閉じられた後、ViewControllerのテーブルビューをリロードするにはどうすればよいですか。

viewController1にテーブルビューがあり、viewController2へのページカールを使用したトランジションがあります。

viewController1にはtableViewがあり、ページのカールを閉じた後に再ロードする必要があります。

助けてくれてありがとう

4

4 に答える 4

4

Ok、

viewControllers1で、viewDidLoadに通知を登録します。

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:@"MyNotification" object:nil];

メソッドを追加します。

- (void)handleNotification:(NSNotification*)note {
   [tableView reloadData];
}

viewController2で、viewController1に移動するとき、またはテーブルをリロードするときに通知を投稿します。

[[NSNotificationCenter defaultCenter] postNotificationName:@"MyNotification" object:self];
于 2013-02-06T16:02:24.950 に答える
0

viewController1のviewWillAppearメソッドでは、テーブルビューのメソッドを呼び出すことができますreloadData

于 2013-02-06T15:37:40.797 に答える
0

viewController1の

- (void)viewDidDisappear:(BOOL)animated
{
   [tableView reloadData];
}

tableViewはメンバーである必要があります。

于 2013-02-06T15:38:53.263 に答える
0
  In first viewcontoller.h  put this in viewdidload

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handle_data) name:@"reload_data" object:nil];

-(void)handle_data
{
[yourtableview reloaddata];
}

In second viewcontroller.h
[[NSNotificationCenter defaultCenter] postNotificationName:@"reload_data" object:self];
于 2014-05-22T09:34:20.617 に答える