Create a static class library for iOS

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.