xcode4.2手动添加MainWindow.xib
参考来自:http://blog.csdn.net/muyu114/article/details/6896498
1、新建一个空的应用程序
2、添加一个空的xib文件
到这里工程的应该是下面这个样子的:
3、改变File’s Owner的class为UIApplication
4、从Library中添加一个Object,并设置其class为你对应的应用程序的类(这里是DemoAppDelegate)
5、添加windows,并在程序中设置windows为IBOutlet
The xAppDelegate.h should read something like this:
@interface DemoAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) IBOutlet UIWindow *window; @end
6、将windows与xib中的文件连接起来,并设置相应的代理
- Control-Drag from the window outlet of the xAppDelegate to the Window.
- Just for this demo, I’m adding a label to the window.
7、设置应用程序的主界面
- Navigate to the project, and in the Summary tab, select MainWindow as the Main Interface.
You can now run the project in the Simulator, and the window should show up. However there’s one last thing you might want to clean up. In xAppDelegate.m, there was actually code that creates a window as well. Just put the method
- (BOOL) application:didFinishLaunchingWithOptions:
in comment.
I hope this helps to understand exactly how an iOS app starts. The next thing you should do is add a ViewController, and push it onto the MainWindow. I’m not going to cover that here. Please leave your feedback in the comments.
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步