苹果真脑残。

news/2024/10/18 10:26:46/

升级到xcode4.2后,无法建立windowbased application了,只能建empty,建了这个之后里面没有mainWindow.xib,只能自己手动添加,霍比麻烦。请参考:http://www.trappers.tk/site/2011/06/16/mainwindow-xib/

1. Create new project in Xcode 4.2 beta and choose “Empty Application” template
2. Add “New File” to the project by choosing “iOS -> User Interface -> Empty”
3. Choose “iPhone” and name “MainWindow” (.xib will be added automatically)

4. Open “MainWindow.xib” in project navigator
5. Click “File’s Owner” in “Placeholders”
Change Class as “UIApplication” in “Identity Inspector”
6. Drag “Object” in the library into “Objects” panel on the left
7. Change the class of the Object as your delegate class, such as “DemoAppDelegate”
(The name of object will be automatically change like “Demo App Delegate”)
8. Drag “Window” in the library into “Objects” panel on the left

9. Open “DemoAppDelegate.h” in project navigator
10. Find below code

@interface DemoAppDelegate :
UIResponder
@property (strong, nonatomic)UIWindow *window;
@end
11. Change as below:

@interface DemoAppDelegate :
UIResponder
@property (strong, nonatomic) IBOutlet UIWindow *window;
@end
11. Open “MainWindow.xib” in project navigator
12. Click “File’s Owner” in “Placeholders”
13. Control-Drag “delegate” of “Outlets” in “Connections Inspector” to “Demo App Delegate” in “Objects”
14. Click “Demo App Delgate” in “Objects”
15. Control-Drage “window” of “Outlets” in “Connections Inspector” to “Window” in “Objects”

16. Open “Summary” of your project
17. Find “iPhone / iPod Deployment Info”
18. Change “Main Interface” as “MainWindow”

19. Open “DemoAppDelegate.m” in project navigator
20. Find below code

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];

[self.window makeKeyAndVisible];
return YES;
}
21. Change as below

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
//self.window.backgroundColor = [UIColor whiteColor];

[self.window makeKeyAndVisible];
return YES;
}
—- Finish —–


http://www.ppmy.cn/news/794257.html

相关文章

色盲悖论的解决方法

18世纪时,英国化学家约翰道尔顿(John Dalton)提出了“色盲悖论”: 假设一个人有一种奇怪的色盲症,他看到的两种颜色和别人不一样,比如他把蓝色看成绿色,把绿色看成蓝色,但是他自己并…

越过越好的人,都戒掉了这个习惯

习惯性拖延,正在悄悄拖垮你 这些场景,你是不是很熟悉?闹铃响了,关了再睡一会儿吧,结果上班迟到;要出发才开始打包行李,到了机场发现忘带重要物品;办了健身卡,每次拖拖拉拉&#xff…

看狄仁杰如何让武则天戒色的

好色是人的天性,男人如此,所以有了“窈窕淑女,君子好求”的千古佳句,女人亦如此,因而今天的成语词典里多了一条“看杀卫王玠”。论好色的本事,历史上因此出名的女人比比皆是,比如南北朝的山阴公主一次就向她的皇帝大哥要了三十个男宠,著名的贾南风更是玩一个杀一个,不…

电影《色戒》观后感

上个周末,公司工会组织大家看电影,影片列表中恰好有《色戒》。老婆早就要求去看了,这次刚好有免费的,欣喜地很。 不过看过之后还是有点失望。总感觉中国人拍电影还是太表面化,只是一些大场面,大制作&#…

学网络安全都是一群什么人?

大家好呀,我是知了姐,又是一期学员故事栏目~ 3月下旬知了堂信安方向开新班,知了姐跟着去采访,了解到新学员们的求学故事,嘿你别说,虽然大家出身专业不同、经历背景不同,如今却在同一个地点相遇…

红豆戒色_红豆简介

红豆戒色 Redbean简介 (An Introduction to Redbean) When it comes to RAD and prototyping, there are lots of tools available to help get projects up-and-running quickly. From quick-starts to micro-frameworks, from build tools such as Composer to one-click ins…

色鬼色狼和色仙的区别

色鬼就是那些见了女人就动心的男人,不论对方年老年幼、貌美貌丑,用贾母的话说是 “香的臭的都往屋里拉”。女人若是碰到这种男人,最好逃之夭夭。 色人就是这样:他们喜新厌旧,常常幻想撞上桃花运,但是还是想…

程序员是怎样的一群人

程序员是怎么样的一群人? 如果用一句通俗易懂的语言来描述,以“写代码为工作内容的人群就是程序员”。 我本身是个写服务器端程序的程序员,今天分享一下自己做两年程序员的心得,从程序员本身去认识程序员。 程序员的有诸多类别。…