Questions about Cocoa Touch

Source: Internet
Author: User

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

 
 
  1. UIGraphicsBeginImageContext(self.view.bounds.size);  
  2. [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];  
  3. UIImage *image= UIGraphicsGetImageFromCurrentImageContext();  
  4. UIGraphicsEndImageContext();8 9 UIImageWriteToSavedPhotosAlbum(image, self, nil, nil); 

Add header file:

 
 
  1. #import <QuartzCore/QuartzCore.h> 

Link Library file:

 
 
  1. QuartzCore 

Summary: AboutCocoa TouchThe content of those questions has been introduced.Cocoa TouchIs there any gains, so I hope this article will help you!

Related Article

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.