提前致謝。我目前正在開發iPad版本的應用程序,該應用程序在iPhone上有3個選項卡,每個選項卡加載3個不同的RSS提要,然後深入到iPhone上的導航控制器的細節。在iPad上,有意義的是,我在第一個分割視圖中加入了2個供稿,然後爲第3個供稿分別提供了一個主要和詳細信息。iPad拆分視圖中的多個主視圖和詳細視圖,uisplitview
完成此操作的最佳做法是什麼?我現在有建立在第一的DetailView工具欄按鈕,它調用其切換主和細節爲使
- (void)switchViews {
VideoSelectorViewController *masterViewController = nil;
VideoDetailiPadViewController *detailViewController = nil;
UIViewController *tempDetail = [self.splitViewController.viewControllers objectAtIndex:1];
UIViewController *tempMaster = [self.splitViewController.viewControllers objectAtIndex:0];
[tempDetail.view removeFromSuperview];
[tempMaster.view removeFromSuperview];
[tempDetail release];
[tempMaster release];
tempDetail = nil;
tempMaster = nil;
// if (row == 1) {
VideoSelectorViewController *newMasterViewController = [[VideoSelectorViewController alloc] initWithNibName:@"VideoSelectorViewController" bundle:nil];
masterViewController = newMasterViewController;
VideoDetailiPadViewController *newDetailViewController = [[VideoDetailiPadViewController alloc] initWithNibName:@"VideoDetailiPadViewController" bundle:nil];
detailViewController = newDetailViewController;
// }
// Update the split view controller's view controllers array.
NSArray *viewControllers = [[NSArray alloc] initWithObjects:masterViewController, detailViewController, nil];
self.splitViewController.viewControllers = viewControllers;
[viewControllers release];
/* // Dismiss the popover if it's present.
if (popoverController != nil) {
[popoverController dismissPopoverAnimated:YES];
}*/
// Configure the new view controller's popover button (after the view has been displayed and its toolbar/navigation bar has been created).
// if (detailViewController.popover != nil) {
[detailViewController showRootPopoverButtonItem:detailViewController.rootPopoverButtonItem];
//}
[masterViewController release];
[detailViewController release];
}
當iPad處於橫向而是縱向的barbutton不顯示此工程確定了的appdelegate工具欄,我怎麼能調用 - (void)splitViewController:(UISplitViewController *)svc willHideViewController編程?此外,我的方法的內存管理,我應該釋放,並設置爲無以前的主和細節,因爲我在我的switchViews方法中的那些臨時對象?
另一種方法是將新主人推到舊的位置,只需更換詳細信息即可。這是更好的,聰明的內存,性能等再次感謝