1. Create a hello WorldProgram
1. Start xcode, file-> new project
Select command line utility on the left and foundation tool on the right.
2. Compile and run
Click build and go or command + R to compile and run the program.
Class is the core of objective-C, and objective-CProgramAll are performed around classes. The objective-C program consists of at least three parts:
1. Class interface: defines the class data and methods, but does not include the implementation of
Common nsfilemanager operations
-(Bool) contentsatpath: path // read data from the file specified by a path-(bool) createfileatpath: path contents :( nsdata *) data attributes: ATTR // write data-(bool) removefileatpath: path handler: Handler //
Category is one of the most common functions in objective-C.
Category can add methods for existing classes without adding a subclass.
The standard syntax format of the category interface is as follows:
# Import "class name. H" @ Interface
1. Category)
The classification in object-C is a compilation method that allows us to expand a class by adding a method (but new instance variables cannot be added through category ), and we do not needCodeThis is similar to defining attributes
Http://www.davidhamrick.com/2012/05/28/Adding-Properties-to-an-Objective-C-Category-Revisted.html
In my last post I wrote about adding properties to a categoryIn objective-C. I have ended up using this feature quite a bit recently so I wrote a
@ Interface => start to define a class.
@ End => end
@ Implementation => class implementation
@ End => end
# Import => reference header files
@ Property => Objective-C 2.0 syntax, defining an attribute
ID
ID
Objective-CStudy NotesPreprocessingProgramIs the content to be introduced in this article, mainly introducesPreprocessing ProgramStatement usage,Preprocessing ProgramThe statement is marked. Let's take a look at the details.
I. # define
1. More
Common nsfilehandle operations
+ (Nsfilehandle *) filehandleforreadingatpath: path // open a file for the read operation + (nsfilehandle *) filehandleforwritingatpath: path // open a file for the write operation + (nsfilehandle *)
In objective-C, the process for defining a singleton class is as follows:
1. Define a static class object. The initial value is nil.
2. In the factory method (generally named "sharedinstance" or "sharedmanager"), use allocwithzone only if
1. Objective-C calls the js method. You only need to call the method that comes with uiwebview.
[Webview stringbyevaluatingjavascriptfromstring: [nsstring stringwithformat: @ "gethtmlstring ('% @')", htmlstr];
2. When JS calls the objective-C
The following are the notes for learning objective-C 2.0. The original book I purchased is the original English version. Due to my limited level of English, there may be omissions in understanding.
Original book purchase address: Amazon
4.
Many beginners are confused about nil, nil, null, nsnull, and [nsnull null! First, use the online explanation:
Nil: a null pointer to an objective-C object. pointer.
Nil: a null pointer to an objective-C class. pointer.
Null: a null pointer to
Recently in the company to do a handheld frog game project, is using C ++ write cocos2d-x development, it is the iPhone cocos2d framework of another language version of the implementation, the biggest advantage is that it can run across platforms.
Some of them haven't had time to read it. Put it here first: 1. Treat the object as memory.
The status of each object instance is saved in different memory regions. Therefore, the object creation and deletion actions are equivalent to the allocation
In objective-C, the call method is calledSend message
The notification object performs an operation. Syntax:[Shape draw]
I. Class Declaration (Interface ):
@ Interface testcoop: nsobject {Int Imonth;Int iyear;Int iday;}
-(Void) setyear: (INT)
In objective-C, when a class is used to another class and the referenced pointer needs to be created in the Class header file,
I. # import and @ Class
The following code is used:
A. H file
#import "B.h"@interface A : NSObject { B *b;}@end
For
Category is one of the most commonly used functions in objective-C. Category can add methods for existing classes without adding a subclass. In addition, we can add methods for a class without knowing its internal implementation. If we want to add a
Http://unmi.cc/objective-c-dp-singletonObjective-C design pattern Singleton
2011-08-25-Unmi
As the simplest one in the design mode, the singleton mode is still used in many systems. There are always some instances that only need one of them from the
Cocos2d-x learning exchange group: 140326755
Email: hahayacoder@gmail.com
Background
I have been interested in mobile development and mobile game development, but has been in the soy sauce status, recently also learning cocos2d-x, and then by the
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