This is the first Mac OS app development Study, Hope is a good start.
First, why to learn Mac OS app development
A) for a long time to do iOS development, found that their own limitations on some of Apple's libraries, some of the underlying API is private, not conducive to their understanding of the operating system, learning Mac OS can increase the understanding of the underlying system, OC also has a wider range of application space.
b) usually use the Mac to find some of the above software is not good, if you write, I believe you can write better.
c) Mac OS development and all other development work is the same, in addition to the level of coding, but also want to improve their macro software design capabilities, broaden their horizons, improve the ability to solve problems.
II. Course of study
A) in order to improve efficiency, after reading a chapter, record the content of the reading.
b) Handwritten correspondence code
Third, Get Start (chapter II)
1, XIB can be understood as XML Interface builder file format XML interface, NIB is XIB compiled binary products, nib is next Interface builder.
2. Effect
3. Code Interpretation
1 @interfaceViewcontroller ()2 3@property (weak) iboutlet Nstextfield *Randomlabel;4 5 6 @end7 8 @implementationViewcontroller9 Ten-(void) awakefromnib One { A [_randomlabel setobjectvalue:[[nsdate Date] description]; - } - the- (void) Viewdidload { - [Super Viewdidload]; - - //Do any additional setup after loading the view. + } - +- (void) Setrepresentedobject: (ID) Representedobject { A [Super Setrepresentedobject:representedobject]; at - //Update The view, if already loaded. - } - --(Ibaction) Seedreset: (ID) Sender { - in - //Seed the random number generator with the time to Srandom ((unsigned) time (NULL)); +[_randomlabel SetStringValue:@"Generator seeded"]; - the } *-(Ibaction) Genrandom: (ID) Sender { $ Panax Notoginseng intgenerated; -generated = (int) (random ()% -) +1; theNSLog (@"generated =%d", generated); + //Ask The Text field to change what it is displaying A [_randomlabel setintvalue:generated]; the } + - @end
Two button connection Action,textfield connection outlet
The code is on Baidu, the address is: Http://pan.baidu.com/s/1jG8DPhO
Cocoa®programming for Mac®os X (1)-Get Start