私が現在iPadアプリで直面しているこの問題に対処する方法について、誰かがいくつかの提案/ポインターを提供できるかどうかを確認したかった。以下に説明しているグラフィックへのリンクを示し ますhttp://www.yogile.com/dsruyzk7/41m/share/?vt=QANtu4j
基本的に、2つの子ViewControllerを含むparentViewControllerがあります。子1にはUITableViewがあり、子2にはカスタムUIViewがあります。子1のUITableviewから子2のカスタムUIViewにdidSelectRowAtIndexPathから情報をロードできます。子2にデータが表示された後、処理を行います。処理が完了したら、子1のUITableViewを更新して、新しい/更新されたデータがUITableViewに表示されるようにする必要があります。子1でデリゲートを作成しようとしましたが、機能していませんでした。何か間違った設定をした可能性があります。したがって、ヘルプの提案をいただければ幸いです。
ありがとう
子2ViewControllerの.h
@class Child2ViewController;
@protocol child2Delegate <NSObject>
- (void)refreshTable:(Child2ViewController*)controller passedDict:(NSDictionary *)dict;
@interface Child2ViewController:UIViewController<UITableViewDataSource, UITableViewDelegate> {
UITableView *myTableView;
id<child2Delegate> delegate;
Child1ViewController *child1VC;
}
@property (nonatomic, weak) id<child2Delegate> delegate;
…
…
@end
子2ViewControllerの.m
@synthesize delegate;
…
..
..
#after all the processing is done we are ready to refresh the view
#updatedDictForTableView is basically a NSDictionary and has the updated data needed
#for the UITableview on child1VC.
-(void)processData {
child1VC.delegate = self
NSLog(@"Dump the updated Data : %@", updatedDictForTableView);
[delegate refreshTable:self passedDict:updatedDictForTableView;
}
Child1ViewControllerの.h
@interface Child1ViewController : UIViewController <child2Delegate> {
….
….
..
}
Child1ViewControllerの.m
- (void)refreshTable:(Child2ViewController*)controller passedDict:(NSDictionary *)dict {
NSLog(@"dump dict %@", dict);
[myTableView reloadData];
}