ProgramSometimesCodeShare, but do not want other programmers to see the shared code logic, and change the shared code. In this case, we need to make our own static class libraries. Using static class libraries has the following benefits:
1. Under protectionSource codeTo share code with others.
2. The compilation time can be reduced.
The process of creating a static class library is as follows:
1. First, create the project staticlibary.
2. Add the static class library to targets. Add new taget. Select static library and add the name example.
3. Add a static statictext class. Select example in targets.
# Import "statictext. H"
@ Implementation statictext
-(ID) Init
{
Nslog (@ "============= ");
Return self;
}
@ End
4. Click info of staticlibary in targets.
5. Click Add.
6. Compile command + B.
7. Open products and the compiled. A file appears.
8. Create a test class named staticceshi.
9. Add the. A file just created and the header file.
10. Call the program.
-(Void) viewdidload {
[Super viewdidload];
[[Statictext alloc] init];
} Wind fashion Java-JavaScript mogujie.com women's clothing
11. Run.
Note: The static Library added to the project must be the same as the running environment, that is, the static library generated by the simulator must be used in the simulator project, the static library generated by the real machine must be used in the real machine project. The two static libraries must be generated separately.