所以,presentModalViewController問題!
我有一個表單(這基本上是一個UITableView),一旦我完成表單,我點擊屏幕頂部的'完成'按鈕。
點擊後,我需要將數據添加到另一個tableView(這是另一個tableViewController)。該表格也位於導航控制器內。
當我按下完成按鈕後,我需要將presentModalViewController作爲新的TableView(帶有新數據)以及位於tableView頂部的導航控制器。
因此,要總結:
- 完成按鈕是someTableViewController。
- 我需要添加一個對象(爲了簡單起見,我只是說我添加了一個名爲「Dobby」的名稱)到另一個名爲dogTableViewController的tableView中。
- 我重新加載數據,並在dogNavigationController中顯示具有dogTableViewController的屏幕。
- 所有的類都被正確引用幷包含在內。
我點擊完成按鈕時正在粘貼 - (IBAction)。
-(IBAction) doneWithData: (UIBarButtonItem*) sender{
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
[indicator sizeToFit];
indicator.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleBottomMargin);
indicator.tag = 1;
[self.view addSubview:indicator];
[indicator setBackgroundColor:[UIColor clearColor]];
indicator.center = self.view.center;
indicator.hidden = FALSE;
[indicator startAnimating];
if (self.dogTableViewController == nil)
{
DogTableViewController *temp = [[DogTableViewController alloc] init];
self.dogTableViewController = temp;
[temp release];
}
if (self.dogNavigationController == nil)
{
DogNavigationController *temp = [[DogNavigationController alloc] init];
self.dogNavigationController = temp;
[temp release];
}
[self.dogTableViewController.dogArray addObject:@"Dobby"];
[self.dogTableViewController.tableView reloadData];
NSLog (@"%@", [self.dogTableViewController.dogArray objectAtIndex:0]);
//Prints out "Null" //
[self presentModalViewController:dogNavigationController animated:YES];
[indicator release];
}
當我做了這一切,並單擊完成按鈕,
我與它沒有表空導航畫面。另外我還在dogNavigationController屏幕上有一些按鈕。沒什麼可見的!
我的目標是將屏幕轉移到這個新屏幕(恰好是主屏幕,而不是rootController)。你認爲我應該用modalViewController來完成這個任務嗎?你認爲我應該用其他方式將數據傳輸到另一個屏幕嗎?
p.s.我不想使用PushViewController。
主屏幕?你不應該彈出嗎? – 2011-06-08 15:52:35
這是應用程序的工作方式... 1 - > 2 - > 3-> 4-> 1 – Legolas 2011-06-08 15:55:27
我點擊完成按鈕4,我需要1顯示添加的數據。 – Legolas 2011-06-08 15:55:59