Cocoa®programming for Mac®os X (1)-Get Start

Source: Internet
Author: User
Tags generator

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

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.