Ios Development Study Notes (1) and ios development study notes

Source: Internet
Author: User

Ios Development Study Notes (1) and ios development study notes
Objective-c basic summary chapter 1

1. application: didifinishlauchingwitexceptions: The program is executed immediately after it is started.

2. startup interface code format:
Self. window = [UIWindow alloc] initWithFrame: [UIScreen mainScreen] bounds];
// 1. Extract the version number from Infor. plist
NString * version = [NSBundle mainBundle]. infoDictionary [key];
// 2. Retrieve the last stored version from the sandbox
NSString * saveVersion = [[NSUserDefaults standaryUserDefaults] objectForKey: key];

If ([version is1_tostring: saveVersion]) {
// If the version is not used for the first time
// Display the status bar
Application. statusBarHidden = NO;
// Wait for writing
// Self. window. rootViewController = [[*** alloc] init];


}
Else
{
// The version number is different. The new version is used for the first time.
// Write the new version number to the sandbox
[[NSUserDefaults standardUserDefaults] setObject: version forkey: key];
[[NSUserDefaults standartUserDefaults] synchronize];
// Display the new version page
Self. window. rootViewController = [[*** alloc] init];
}
[Self. window makeKeyAndVisible];

Return YES;

3. snapshot management: Xcode snapshot is a version control with limited functions (applicable to small and medium projects)

4. CGRectMake uses the first two values to indicate the distance between the text tag and the upper and lower edges of the screen. The last two values represent the width and height of the text tag.

5.info. plist end file: Describes the properties of the project. The application icons, startup images, and supported device orientations must be set somewhere. Project navigator to visually set numerous plist options

When the application is running on a device that uses the Retina screen, if it is asked to display an image, it will automatically use the suffix @ 2x (the name is the same as the specified name). This allows developers to support the Retina screen without modifying any code of the application. You can also visualize the Deployment Info section of the Summary cable selection card to set the startup image. For iPhone, only portrait start images can be set, but the iPad supports horizontal and portrait start images.

7. Set the Status bar: Status bar is initially Hidden (Hidden by default) NO display Status bar

 

Chapter 3 Objective-C

1. (1) The Directive types used by OOP are commensurate with procedural programming, but they are organized to make the application easy to maintain and reuse code as much as possible. In OOP, you will create an object that stores data describing something and instructions for manipulating it. (2) Another important aspect of OOP is inheritance.

2. Glossary:
Class: Code defining objects and their functions, usually composed of header files/interface files and implementation files.
Sub-class: it is based on another class and adds additional functions. Almost everything you use in iOS development is a subclass of something else. It inherits all functions and attributes of the parent class.
Superclass/parent class: Class inherited by another class
Singleton: class that can only be instantiated once throughout the life cycle of a program. For example, the class that learns the orientation of the device is implemented as a singleton because only one sensor returns the orientation information.
Object/instance: class called in code and in active state. Class is the code that allows an object to work, and the object is an active class. An object is also called a class instance.
Instantiation: the process of creating an active object based on the class
Instance method: a basic function implemented in the class. For the reminder class, this may be the setAlarm that sets the alarm for the given reminder.
Class Method: It is similar to the instance method, but uses and creates all objects according to the class.
Message: When you need to use an object method, you send a message to the object, which is called a call method.
Instance variable: storage location of a unique object information.
Variable: location where information is stored. It is not used for instance variables. Common variables can only be used in the method that defines it.
"Parameter: Information provided to a method when it is called. If you want to call the "set alarm" method of the reminder object, you must provide the time to set. In this case, this time will be a parameter of the setAlarm method.
Attribute: an instance variable configured with a special compilation command, which can be easily accessed in the code
"Self: A method to reference the current object in a method. When using instance methods or attributes in an application, you must use a specific object to limit it. When writing code to access its methods or attributes in a class, you can use self to reference the current object.

3. The name of the class interface file and implementation file is usually the same as the class name .. H interface file. m implementation file. Protocol is a unique function of Objective-C. Methods to be compiled are collected and identified by the same name. This is called protocol.

4. @ property compilation command, which can be used with another command named synthesize to simplify interaction with the instance variables defined in the interface. @ Property and @ synthesize are used to set and retrieve functions for writing, and are elegant and convenient to use.

5. specifying the attribute (strong, nonatomic) in the Compilation instruction @ property tells Xcode how to handle the attribute reference. Attribute strong tells the system not to delete the referenced object from memory. Property (nonatomic) tells Xcode that you don't have to worry about using this property at the same time in different parts of the application.

6. + class method,-instance method.

7. definition Method 1: + (type returned by the method) method name: (type expected by the method) variable name that references the information, definition method 2: + (type returned by the method) method Name: (expected information type of the method) add a brief description label for the variable name that references the information: Data Type: variable name


8. If you do not know what will be passed to the method or want to return different types of objects from the same method, the id type is very useful.

9. The combination of @ property and @ synthesize enables us to access and modify instance variables in an intuitive way.

10. @ implementation myclass tells Xcode to implement that class in this file

11. The method of use is called sending information to an object.

12. some (Circular references) ARC cannot be cleared. A references B References C references D References B. A can use object B, but BCD has circular references, these three objects cannot be released. To avoid such problems, you can use Weak reference)

Chapter 4: Cocoa Touch

1. Each Apple iOS application template contains three important frameworks (CoreGraphics, Foundation, and UIKit)

2. cocoa Touch layer: (1) UIKit: starts and ends applications, control interfaces, and multi-Touch, and allows you to access common data views (Word Excel) (2) Map Kit: allows developers to add Goodle map views to any application, including tagging, locating, and event processing functions (3) Game Kit: network interaction (4) message UI/Address Book UI/Event Kit UI: integration requirements between applications (5) iAd: Add applications to ads

3. Multimedia layer: (1) AV Foundation: Used to play and edit complex audio and video. Such as movie recording, Audio track management and Audio translation (2) Core Audio: provides methods for playing and recording Audio on the iPhone (3) Core Image: add advanced image and video processing functions to the application (4) Core Graphics: Add 2D Session and merge success (5) precise Positioning and control of text displayed on the iPhone screen (6) Image I/O: Import and Export of Image data and Image metadata (7) Media Player: easily play a movie with a typical screen space (8) OpenGL ES: Create a 2D 3D animation (9) Quartz Core for creating an animation: Use the hardware features of the device

4. core Service Layer: (1) Accounts: used to store account information of many different services (2) Address Book: Used to directly access and operate the Address Book (3) CFNetwork: access BSD sockets, HTTP and FTP requests, And Bonjour discovery (4) Core Data: create a Data model to provide a database model with SQLite relationships
(5) Core Foundation: Same as the Foundation framework (6) Foundation: provides an encapsulate (operating string arrays and dictionaries are all performed through the Foundation framework) (7) Event Kit: access stored calendar information (8) Core Location: used for iPhone iPad 3g gps to obtain latitude and longitude and Measurement Accuracy
(9) Core Motion: managing most Motion-related events: using accelerator and gyroscope (10) Quick Look: Implementing file browsing (11) Store Kit: Creating and purchasing physical objects (12) system Configuration: used to determine the current status of the device network Configuration


5. Core OS layer: (1) Accelerate: simplifies computing and big data operation tasks, including digital signal processing
(2) External Accessory: Used as an excuse to develop accessories (3) Security: provides encryption (add and delete modified key items) (4) System: access some typical tools in unrestricted UNIX development environments

6. NSObjct UIApplication UIWindow UIView UIResponder UIControl UIController

7. String NSString/NSMutableString where NSMutableString is available and can be modified. NSString cannot be changed after initialization, and NsMutableString can be modified (extended, shortened, and replaced)

8. Array (NSArray/NSMutableArray)

9. The Dictionary (NSDictionary/NSMutableDictionary) exists as a key-value pair.

10. Numbers (NSNumber/NSDecimalNumber) can be easily added to arrays or dictionaries as objects. NSDecimalNumber is a subclass of NSNumber.

11. Date (NSData)

12. URL)

13 Interface Class: UISwitch UISegmentedControl (UISlider) step control (UIStepper) text box (UITextField/UITextView) UIPopoverController)

Chapter 5: Cocoa Touch

1. instantiation refers to the instance for creating objects so that you can use them in the program to obtain all functions of the class.

2. Open the storyboard to display the file skeleton of the Board.

Chapter 6: Model-View-Controller Application Design

1. The View Controller can contain the application logic, but this does not mean that all Code contains the View Controller. Additional classes can be defined during verification. The application logic has been abstracted.

2. use IBOutlet: Used to allow code to interact with objects in the view (for example, @ property (strong, nonatomic) UILbel * myLabel1 and @ property (strong, nonatomic) IBOutlet UILbel * used together with myLabel1)

3. For each Compilation instruction in the interface file. h @ property implementation file. m, the corresponding compilation intelligence is required. @ synthesize

4. Use IBAction: used to indicate that the corresponding methods in the code should be called when a specific event occurs. (For example, if the user clicks a button or updates the text box)

5. AppDelegate. h and AppDelegate. m form the delegate of the UIAppkucation instance created in this project, which can edit files and add methods to control how the application runs.

6. ViewController. h ViewController. m implements a View Controller (UIViewControoler). This class contains the logic of control attempts.

7. Make sure that the instance variables defined in the Code do not point to the object after the attempt is completed. You can set the attributes corresponding to instance variables to nil so that the memory occupied by these text boxes and labels can be reused.

 

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.