Cocoa touchThe software development api provided by Apple is used to develop software on the iphone, ipod, and ipad. It is also a class library provided by Apple for rapid development of iPhone applications. This library exists as a series of framework libraries and allows developers to use user interface elements to build image-driven event-driven applications. This article describes the iphone technology layer, static library, and screenshots.
Iphone technology layer
Cocoa TouchA layer consists of multiple frameworks that provide core functions for applications.
UIKit is responsible for starting and ending applications and controlling interfaces and multi-contact events.
Map Kit provides Map-related services
Create and use a network mechanism for Game Kit
Message UI/Adress Book UI provides operation email and contact information
Cocoa Touch Association static library Method
Purpose: To reuse code and write a public object toStatic LibraryPublic.
Create a Cocoa Touch static library project MyLib and write the corresponding code.
Create a test project TestLib, open MyLib, select MyLib in MyLib, drag it into the TestLib project, and select Copy.
Prepare the library header file and add it to TestLib.
Double-click the TestLib target under Targets in TestLib and add MyLib to Direct Dependencies in General.
Click the small triangle on the left of the TestLib target under Targets in TestLib, expand MyLib in TestLib, and drag libMyLib. a to Link Binary With Library.
Write and run the test code.
The advantage of doing so is that you can modify MyLib next to it, while TestLib does not need to be updated. The called function is automatically updated. For example, if you first write a function in MyLib, operate on the two numbers, return the result of adding them, and then add MyLib to TestLib (using the above method ). Later, the database needs to change. For the same function, the result of two Subtraction is returned. In this case, you only need to open MyLib and re-compile TestLib. You do not need to delete MyLib in TestLib before adding it. Great convenience.
Cocoa Touch screenshot code
- UIGraphicsBeginImageContext(self.view.bounds.size);
- [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
- UIImage *image= UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();8 9 UIImageWriteToSavedPhotosAlbum(image, self, nil, nil);
Add header file:
- #import <QuartzCore/QuartzCore.h>
Link Library file:
- QuartzCore
Summary: AboutCocoa TouchThe content of those questions has been introduced.Cocoa TouchIs there any gains, so I hope this article will help you!