Stanford iOS Handout Courseware Summary II

Source: Internet
Author: User

The number of parameters in the 1,oc is different, it can be two completely different methods. Such as

-(void) Addcard: (card *) Card attop: (BOOL) attop;

-(void) Addcard: (card *) card;

A second method can be implemented

-(void) Addcard: (Card *) card{[self addcard:card attop:NO];}

2, because to keep the card inside the method, so these three methods are written in the. h file.

-(void) Addcard: (card *) Card attop: (BOOL) attop;

-(void) Addcard: (card *) card;

-(Card *) Drawrandomcard;

And here the object is private, so the following line will be written in the. m file.

@property (Strong, nonatomic) nsmutablearray *cards;

The direct call to cards is definitely empty, so lazy instantiation.

-(Nsmutablearray *) cards {

if (!_cards) _cards = [[Nsmutablearray alloc] init];

return _cards; }

3, the C function of the random number arc4random ()% N, generates a random number of 0 to N.

Initializes the link string, [nsstring stringWithFormat:@ "%d%@", self . Rank, self . Suit];

Initializes an array of @[@ "?" , @ "A", @ "2"];

4,+ is a modified class method.

5, overriding initialization method -(instancetype) init{self = [Super init];

If (self) {

return self;

}}

6,xcode basic use of points skipped

7, get image UIImage *cardimage = [UIImage imagenamed:@ "card"];

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.