故事板xcode 4中添加的视图控制器的.h和.m文件

时间:2022-10-30 22:49:58

I've created the flow of my application with storyboard. It's a navigation based storyboard layout with a few stacks of views. Where can I create .h and .m files to actually make the app DO things? The general navigational flow of the app is just fine as a result of story board, but I need to add my own code to the views. Thanks!

我用故事板创建了我的应用程序流程。这是一个基于导航的故事板布局,有几堆视图。我在哪里可以创建.h和.m文件来实际制作应用程序?由于故事板,应用程序的一般导航流程很好,但我需要将自己的代码添加到视图中。谢谢!

1 个解决方案

#1


33  

Go to File->New->New File and create a UIViewSubclass without the xib/nib for each view that you have. This will create the .h and .m files. Then, select the view in the storyboard and go to Identity Inspector in the right column view. Under Custom Class->Class, select the new UIViewSubclass (by name) that you just created. This will link the view with the header and implementation files.

转到File-> New-> New File并为每个视图创建一个不带xib / nib的UIViewSubclass。这将创建.h和.m文件。然后,在故事板中选择视图,并转到右侧列视图中的Identity Inspector。在Custom Class-> Class下,选择刚刚创建的新UIViewSubclass(按名称)。这将链接视图与标头和实现文件。

#1


33  

Go to File->New->New File and create a UIViewSubclass without the xib/nib for each view that you have. This will create the .h and .m files. Then, select the view in the storyboard and go to Identity Inspector in the right column view. Under Custom Class->Class, select the new UIViewSubclass (by name) that you just created. This will link the view with the header and implementation files.

转到File-> New-> New File并为每个视图创建一个不带xib / nib的UIViewSubclass。这将创建.h和.m文件。然后,在故事板中选择视图,并转到右侧列视图中的Identity Inspector。在Custom Class-> Class下,选择刚刚创建的新UIViewSubclass(按名称)。这将链接视图与标头和实现文件。