Demo Download http://download.csdn.net/detail/u013375242/8335911
Don't talk nonsense, iOS development, with Xcode, project structure as follows:
1. Define the My_extern class, inherit the NSObject,
. m file as follows
.:
2. The Viewcontroller call, without introducing the header file on the class, is used directly in ViewController.h: The following:
extern usage Explanation
Variables defined in the source file A are invisible (i.e. inaccessible) in other source files. In order to call this function in the source file B, an external declaration should be added to the head of B:
extern variable;
in this way, the variable can also be called in the source file B.
Note the word difference here: In A is the definition, in B is the statement. A function can only (and must) be defined in one source file, but it can be declared in many other source files. The definition causes the storage allocation to actually produce that entity. Declarations do not cause storage allocations. Make a vulgar analogy: after declaring it in the source file B, it's like opening a window in B, so that it can see the variable in a.
IOS extern Use tutorial