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"];