IOS tutorial-1) Objective-C Basics

Source: Internet
Author: User

Objects and Classes
A class consists primarily of two things: variables that can store data and methods
That can perform operations.

Subclasses
Classes can also inherit functionality from an existing class

Instance and class variables

Changing the value of an instance variable in one object
Will not affect the value of the same variable in all the other objects of that class.
Conversely, only a single copy of A Class variable exists. If you change the value
A class variable from one object, the value of that variable will change for all
Objects of that class

Accessor methods
Accessor methods, sometimes called getters and setters, are usually fairly simple
Methods used to get and set instance variables in a class

Class Methods
Class methods (also known as static methods) are methods that are associated directly

With the class rather than the object instance

Events and messages
An event is a message generated by the user interacting with your application's
Controls. For instance, if you tap the screen of your iOS device, this generates a UI
Event in your application that is passed via a message from the application to
Object that has been delegated to deal with that specific type of event

Protocols
A Protocol definition declares methods that any class can implement. If your class
Declares that it abides by a participating Protocol definition, you are announcing that
You have implemented the minimum mandatory methods declared in the Protocol
Definition, and may optionally have implemented some nonmandatory Methods

Delegate classes
A delegate class is a class that implements a protocol for handling events.

Event Loop
The main event loop is the principal control loop for your application.

Reference counting

Reference counting is a form of garbage collection, which counts the number of references
To an object (or portion of memory) and frees the associated memory when
Number of references reaches zero. The main advantage of reference counting over
"Classic" garbage collection is that memory is freed as soon as it is no longer in use

 

 

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.