[Learning notes] [OC language] Object-oriented Thinking, learning notes oc
I. object-oriented and process-oriented ideasOC is object-oriented and C is process-oriented. Object-oriented and process-oriented are only two different ideas for solving problems.1. Differences between object-oriented and process-oriented1. Take listening to songs on a computer as an ExampleProcess-orientedTurn on your computerPlay
Ios development-commonly used classical algorithms OC bubble/quick, ios algorithm ocBubble sorting and quick sorting
1. Preface
There are not many algorithms involved in ios development. Unless your application is really large, Or you want your application to have a very good performance, you can think of algorithm-related performance optimization, what is actually available in ios development is sorting. Of course, if you are playing games, you ma
: create a New Folder
Source Control: create a local git resource library for this project.
5. After the project is created, open the Xcode development environment. View the project structure.650) this. width = 650; "class =" WACImage SCX96041935 "alt =" Image "src =" https://onenote.officeapps.live.com/o/GetImage.ashx? Fi = SD2D97345DA1438C3B! 504 C = 1w.bay-sky-wac-wshi ak = m % 3Den % 2Dus ObjectDataBlobId = {d1f7dc6f-4a63-42e5-aa64-1c30f9209775} {1} usid = guest "_ xhe_src =" https://one
[Self fibonacci:n-1] + [self fibonacci:n-2];}return n > 0? 1:0;}The change to the _cmd implementation becomes this:return (Nsinteger) [Self performselector:_cmd withobject: (ID) (n-1)] + (Nsinteger) [Self performselector:_cmd withobject :(ID) (n-2)];or directly with Objc_msgsend:Return (Nsinteger) objc_msgsend (self, _cmd, n-1) + (Nsinteger) objc_msgsend (self, _cmd, n-2);But every time through the objc_msgsend to call seems very laborious, there is no way to direct the method call it? The answ
I. INTRODUCTION of OC 1. IntroductionIt is based on the C language and adds a layer of object-oriented syntaxOC fully compatible with C languageYou can mix C code, even C + + code, in OC codeApplications that can use OC to develop Mac OS x platform and iOS platform2. Keywords1> basically all the keywords are beginning with @2> keywords@interface, @implementation,
--- Java training, Android training, IOS training, and. Net training. We look forward to communicating with you! ---
1. Development of multiple. m Files
It is the same as developing multiple. c files in C.
(1) Compile three files
The one. m code is as follows:
1 // set two. h. The header file is copied to this 2 # import "Two. H "3 int main (INT argc, const char * argv []) 4 {5 // call test function 6 test (); 7 return 0; 8}
The two. H code is as follows:
1 // Declaration of the test functio
OC Implementation of heap sorting and OC Implementation of heap sorting
/* We recommend that you first check the heap Adjustment Method and understand the heap adjustment. Even if the sorting algorithm has mastered */-(void) viewDidLoad {[super viewDidLoad]; /* test data */NSArray * array = @ [@ 3, @ 2, @ 6, @ 4, @ 1, @ 0, @ 6, @ 7, @ 5]; NSMutableArray * mutable = [NSMutableArray arrayWithArray: array]; mu
Basic OC string operations and basic oc operations
The variable string modification method has a return value (re-pointing to the new string address)
The variable string modification method does not return values (modifying the string itself)
/*
NSString immutable string
*/
// 1. Create a String object
// Use the initialization method to create an object
NSString * string1 = [[NSString alloc] initWithFormat
OC, oc LanguageUse the system method to monitor the network status
The system monitors the network status through the notification mechanism.
Steps for network status monitoring
Define Reachability member variables to save the network status@property (nonatomic, strong) Reachability *reachability;
Observer registered as the notification center// Register the observer [[NSNotificationCenter defa
OC, oc LanguageEffect
Procedure
Draw a rectangle and a alertView is displayed, prompting whether to save the image
Click "yes" to save the image to the album.
View saved images in the album
Implementation
Add an imageView to the Controller view to set the image
Add a pan gesture to the view of the controller.
Track the pan gesture and draw a rectangular box (Cut area of the image)
OC, oc Language
Introduction
Function
Draw
Drawing: lines, triangles, rectangles, circles, and Arcs
Draw text
Draw \ generate image (image)
Read \ generate PDF
\ Crop an image
Custom UI controls (usually controls with complicated internal structures)
Most of the controls in UIKit are drawn by the system.
Matrix operation (changes all paths shown in the following figure)
Zoom
Rotat
OC, oc Language
I. process-oriented
1> Thoughts
Process-oriented is a process-centered basic programming concept and does not support the object-oriented features.
Process-oriented is a modular programming method.
2> Development Method
The process-oriented development method focuses on processes (or modules). It designs different processes into different functions and then calls them accordin
OC, oc Language
I. Reference Counter
1> stack and stack
2> Introduction
3> Basic Concepts
4> Basic Methods
Ii. multi-object memory management
1> basic usage
When an object exists, the retain operation is performed on the object.
When an object is discarded, the release operation is performed on the object.
If the retain operation is performed, the release operation is performed.
2> memory
OC, oc LanguageOverview
Introduction
CAAnimationGroup is also called a group animation or animation group.
Place multiple animations in an animation group and assign them to the animation attributes of the layer. All animations in the animation group are concurrently executed.
Notes
The animation in the animation Group will not be compressed, and the part beyond the animation duration
OC, oc LanguageIntroduction
GCD (Grand Center Dispatch) is Apple's solution for multi-core parallel operations, pure C Language
It is more suitable for multi-core processors and automatically manages the thread lifecycle, making it easier to use
GCD implements multithreading through tasks and queues
Task: describes the operation to be performed.
Queue: used to store the tasks to be executed. T
OC, oc LanguageIntroduction
Each UI control automatically creates a layer (root layer) by default, that is, each UI control corresponds to at least one layer.
Each UIView is associated with a CALayer by default. We can call this Layer as the Root Layer)
All non-Root layers, I .e. manually created CALayer objects, have implicit animation. What is implicit animation?
When some attributes of a non-Root L
Use of the agent in OC, use of the OC agent
Generally, the following steps are required for proxy:
1. Develop an agreement. The protocol can be declared in. h of the delegate object, or in a separate. h. After the protocol is developed, the method that requires proxy objects is declared in the Protocol.
2. Set proxy properties. After the protocol is set, you need to set a proxy attribute for the delegate
OC object: Examples of encapsulation, inheritance, and polymorphism I. oc Polymorphism
// The example of this code in the online video. It is suitable for students with unclear class and object content. It is only for learning and sharing. Thank you.// Create a Pointtest class, which uses attributes x and y to represent the Coordinate Position of a vertex and calculate the distance between two points. Two m
IOS. OC.03 KVO-key-value observer, ios. oc.03kvo-
KVO Key, Value, Observing, that is, Key-Value observer. It provides such a mechanism that when the attributes of a specified object change, KVO automatically notifies the corresponding observer.
Unlike NSNotification, the key-value observation does not have any so-called central object to provide change notifications for all observers. Instead, when a change
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.