本文介绍了如何将我自己的ViewController类设置为第一个屏幕(根视图)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用IPhone作为目标平台在XCode中创建了一个基于Windows的项目,然后我添加了一个ViewController子类。现在我想让我新添加的类在第一个屏幕显示。实现它的正确方法是什么?

I have created a windows based project in XCode using IPhone as target platform and then I added a ViewController Sub Class. Now I want to make my newly added class to be shown at first screen. What is the proper way to achieve it?

问候。

推荐答案

这是我发现的正确方法

首先在appdelegate.h中声明你的视图控制器

first declare your view controller in appdelegate.h

SaveViewController *SaveController;

@property (nonatomic, retain) SaveViewController * SaveController;

然后在你的appdelegate.m文件中合成它

then synthesize it in your appdelegate.m file

@synthesize SaveController;

现在在您的应用程序中添加以下代码行didFinishLaunching方法

now add the following lines of code in your application didFinishLaunching Method

SaveController = [[SaveViewController alloc]initWithNibName:@"SaveViewController" bundle:nil];

[window addSubview:[SaveController view]];


[self.window makeKeyAndVisible];

多数人......你做完了:)

Thats all.. you are done :)

这篇关于如何将我自己的ViewController类设置为第一个屏幕(根视图)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 14:01