-2

I'm looking for a (certainly basic) thing to do in Objective-C/Cocoa : I would like to split my code into multiple files (one for functions, one for tab view N°1 methods, one for tab view N°2 methods, etc) to make my projects well organized.

I would like to be able to call functions and/or methods from my "AppDelegate.m".

But I don't know how to formulate this question correctly to find help around the web. I come from Delphi, and in Delphi you have just to create a new .PAS file and declare it in USES section.

We are in 2013, so it's certainly an ultra-basic way to code properly via XCode :)

Thanks in advance for any help.

4

1 回答 1

4

基本上是一样的——除了 Objective-C 的 C 背景,你必须创建 4 个文件。两个头文件 (.h) 和两个实现 (.m)。

您将使用 .m 文件顶部的 #import 语句代替使用部分。

#import "myClassHeader.h"

由于这属于 Objective-C 或任何基于 C 语言的更基本的任务,你应该从阅读一些初学者教程开始,如何定义类和方法。

于 2013-01-05T17:05:47.513 回答