我有一個Navigaton控制器顯示一個TableView和一個帶有按鈕的工具欄。 如果用戶按下按鈕,則會顯示一個模態視圖並帶有多個按鈕。在按下其中一個按鈕時,將加載一組新的數據,並重新加載tableView。如何在模態視圖中等待用戶輸入時停止執行
在一定的條件下,當一組新數據重新加載時,我需要顯示一個模態視圖來提醒用戶某些情況。
這是代碼我原來寫顯示警報給用戶:
- (void) selectEventosListMVCButtonPressed:(NSInteger)button
{
switch (button) {
.
.
.
.
case 3:
// eventos favoritos
// Load Favourites Events
// This is the new data to load
if (!self.eventosFavourites) {
[self loadEventos:kURLEventosCopyFavourites];
}
// Empty the container
[self.eventosListsContainer removeAllObjects];
// Load Favourites Eventos
[self.eventosListsContainer addObject:self.eventosFavourites];
// Reload the view
[self.tableView reloadData];
// Load Expired Events
// If there are some eventosExpired then show alert to user
if (!self.eventosExpired) {
[self loadEventos:kURLEventosCopyExpired];
}
if (self.eventosExpired) {
// There are expired eventes
// Load a modal view to inform the user
ExpiredEventosMVC *expiredView = [[ExpiredEventosMVC alloc] initWithNibName:@"ExpiredEventosMVC" bundle:0];
expiredView.delegate = self;
expiredView.eventos = self.eventosExpired;
[self presentModalViewController:expiredView animated:YES];
[expiredView release];
}
break;
}
[self.modalViewController dismissModalViewControllerAnimated:YES];
[self.modalViewController release];
}
但模式的看法從來沒有顯示。 爲此,我應該在ExpiredEventosMVC模式視圖顯示給用戶後等待,然後單擊該視圖中的確定按鈕關閉它並繼續流程,但我該怎麼做?後
[self.modalViewController dismissModalViewControllerAnimated:YES];
您的代碼應該駁回控制器: