This is a stopgap measure, and in the absence of Mac OS X, use this scheme to get a sense of objective-c.If it feels good to play down, want to go deeper, or the whole Mac.One: Compile environment installation GNUstepwww.gnustep.org website Download
If the life cycle of an object is obvious, it is easy to know when the new object is to be used and when it is no longer needed, in which case the manual retain and release are used directly to determine its survival and death. But sometimes it's
Find out who's Who's agent first (delegate)Define proxy protocols, naming conventions for protocol names: control class name + DelegateDefining proxy methodsProxy methods are generally defined as @optionalProxy method names begin with the control
Super classThat is, the parent class can call the superclass method through [Super SetName: @ "a"]CompositeRefers to an object that consists of several other objectsObject initialization@interface*engine;)@end@implementation Car-(ID) init{
Code blocks are essentially similar to other variables. The difference is that the code block stores the data as a function body. With code blocks, you can pass in the number of parameters as you would call other standard functions, and get the
This will summarize some of the code code used in OBJECTIVE-C development will slowly increase =) generate a certain range of random numbersobjective-c-(float) Randomfloatstart: (float) a end: (float) b { srand ((unsigned) time (0));
Autorelease detailed/ * Basic usage of 1.autorelease 1> objects are placed in an auto-free pool 2> when the auto-free pool is destroyed, all objects inside the pool are released once 3> returns the object itself 4> After calling the Autorelease
First, the attributeThe objective-c property is the syntax defined by the 2.0, which provides a setter for instance variables, a default implementation of Getter methods that simplifies program code to some extent, and enhances access security for
Memory Management policyThe basic model for memory management is defined in the NSObject protocol and standard method naming conventions in the combination method provided in the reference counting environment. The NSObject class also defines a
What is classificationClassification can be used to extend the method of a class without modifying the code of the original class.Let's look at a simple example:We have a class Calculator we have added and subtracted methods for it:#import
An array of objective-c is more powerful than an array of C++,java, and Nsarray saved objects can be different objects. But can only save objects, int, char,double and other basic data types can not be saved directly, you need to convert to an
Now every day to seize the study, so strive to learn two knowledge points every day, as soon as possible to learn OC, and then into the development phase! Come on.#import int main (int argc, const char * argv[]) {@autoreleasepool { #pragma
Basic conceptsProgram of the world and the Human "object" of the world in the mind is no difference, rich two generations inherit the parents, naturally have all the resources parents have, the subclass inherits the parent class also has the parent
The contents of these days are mostly methods, may be seen in the time feel there is nothing to learn, but these things will be involved in the follow-up, it is best to be able to knock again, so in the back of the time will not feel
What is polymorphic?Polymorphism (polymorphism) literally means "multiple states." In object-oriented languages, many different implementations of interfaces are polymorphic. The description of polymorphism is referenced by Charlie
1: Overall steps for data refresh1.1: Modifying model data1.2: Refresh table (Refresh interface)2: How to refresh the table Global Refresh (each row will be refreshed)-(void) reloaddata; // Partial Refresh (use premise: number of model data
int is a static typeNsinteger is a dynamic typeApple's official recommendation is to use Nsinteger, because in Apple's API implementation, Nsinteger is a package that recognizes the number of bits in the current operating system and automatically
Today, let's take a look at how the array object in OC deals with the reference counting of object elements, and introduces the concept of the automatic release poolhow array objects handle reference counting for object elements // //main.m//
Pre-compilation Directives1. It is best to use double quotation marks to write your own header files, and the system can use angle brackets.*************************************************Dot syntaxP.age= 10;1. Instead of accessing the age member
1. CompatibilityOC is an object-oriented C language that can have C and C + + statements in OC Code, which can call C functions or access methods through C + + objects.2. StringOC usually does not use a C language style string. Most of the cases
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.