Cocoa 学习系列(一)

2016-12-03  本文已影响0人  Rookie_iOS

参考书籍:Cocoa Programming for OS X 5th

示例一:Random PassWord

创建Cocoa Project

1 : 这里选你最拿手的,OK。(我拿手没有,拿钱可行。~ ~ ~)。

2:这里看你心情,你懂的。

3:暂时不勾选。

4:一路next。。。。

现在看起来像这样

接着来:

创建个WindowController,并勾选创建xib,至于要不要建文件夹随你。

完成之后大概酱紫:

然后选中MainViewController.xib文件。在xib上添加控件。

完成之后像这样

在Appdeleagte的- (void)applicationDidFinishLaunching:(NSNotification*)aNotification中添加如下代码:

MainViewController*mainVC = [[MainViewControlleralloc]initWithWindowNibName:@"MainViewController"];

[mainVCshowWindow:self];

self.main= mainVC;

运行一下,就能看到xib的布局结果。

剩下的在MainViewController.m 编写

~~~~~~~~~~~~~~~~~~~~~~ over ~~~~~~~~~~~~~~~~~~~

上一篇下一篇

猜你喜欢

热点阅读