【发布时间】:2012-10-08 12:27:02
【问题描述】:
我正在构建一个在顶层具有 TabBarController 的应用程序。 Contained within one of the tabs there is a tableview, and when a row is selected, I'd like to go to a set of 5 views, controlled via a UIScrollViewDelegate and UIPageControl.
我已经使用 UIScrollViewDelegate 和 UIPageControl 构建了一个基本应用程序,基于 Derek Bredensteiner 在此答案中的代码:How do I use UIPageControl to create multiple views?
它可以作为一个独立的应用程序正常工作,即:当 ViewController 代码直接从 AppDelegate 调用时:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
但是当我尝试从我的 tableview 代码中调用相同的代码时,我得到了一个黑屏。我也尝试过使用 presentModelViewController,我得到了 UIPageViewControl 点,但其余的都是黑色的。
LearnPageViewController *phoneContentController = [[LearnPageViewController alloc] init] ;
// [self presentModalViewController:phoneContentController animated:YES];
[self.navigationController pushViewController:phoneContentController animated:YES];
【问题讨论】:
-
我设法通过添加一个新的窗口属性 @property (nonatomic, retain) IBOutlet UIWindow *window; 让它工作。但这听起来不对。 AppDelegate 上有一个窗口属性,现在又有一个向下 2 级。
标签: ios uinavigationcontroller uipagecontrol