您應該委託PresentModalView的parentView,應該調用referesh方法上PresentModalView的viewWillDisappear。
否則,你可以嘗試推送通知和parentView觀察它。
- (void) refreshMyParentViewController{
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center postNotificationName:@"RefreshNeeded" object:self userInfo:refreshData];
}
//在ParentViewController - AddObserver中檢測數據。 //和你想調用的方法。
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(delegateMethod:)
name:@"RefreshNeeded" object:nil];
- (void)delegateMethod:(NSNotification *)notification {
NSLog(@"%@", notification.userInfo);
NSLog(@"%@", [notification.userInfo objectForKey:@"RefreshObject"]);
}
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(delegateMethod:)
name:@"RefreshNeeded" object:nil];
- (void)delegateMethod:(NSNotification *)notification {
NSLog(@"%@", notification.userInfo);
NSLog(@"%@", [notification.userInfo objectForKey:@"RefreshObject"]);
}
爲什麼要重新加載父視圖? – 2013-02-26 06:48:36
我在「UIModalPresentationFormSheet」視圖中編輯一些數據。我想在父視圖中顯示更改。 – Suppry 2013-02-26 06:49:45
你需要一些其他的通知的變化(KVO,NSNotificationCenter,委託傳遞引用和調用該方法,如此多的方式) – 2013-02-26 06:54:08