【发布时间】:2010-08-21 05:20:30
【问题描述】:
我正在编写一个供 iPhone 开发人员使用的库(类似于实现 OpenFeint 的方式),并且我正在尝试创建一个带有关联 XIB 的 ViewController,以便我可以在我的代码中实例化它
SplashScreenViewController *splashScreenViewController = [[SplashScreenViewController alloc] init];
UIWindow *topApplicationWindow = [self getTopWindow];
[topApplicationWindow addSubview:splashScreenViewController.view];
然而,虽然这适用于简单的控件(UIButtons 等),但我的 SplashScreenViewController 没有显示任何内容。 SplashScreenViewController 很简单:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface SplashScreenView : UIViewController {
}
@end
并且实现是空的。在我的 View XIB (SplashScreenView.xib) 中,我尝试将 File's Owner 的类设置为 SplashScreenViewController 这不起作用,然后我尝试了我在 OpenFeint 中看到的方法,即在 IB 中添加一个 View Controller 和将主 UIView 设为其子级,并将其设为 SplashScreenViewController 类。这也不起作用(不显示)。
我想知道是否有人对我可能遗漏的内容有一个好主意,或者是否有人可以推荐一个演练以按照我尝试的方式创建新的 ViewController。
谢谢!
【问题讨论】:
标签: iphone cocoa-touch uikit openfeint