hey all I'm sure this is a very easy thing to do and it's done frequently but I'm wondering how to make a custom property for a UIImageView be set to a created identifier. This works great with a UIIamge, of course, however what if i want to assign the image view a custom property, suit for example. Im making a simple card game and I'd like to assign a card's ImageView a 'suit' property with an identifier, such as clubs, hearts, spades, or diamonds an example of what I'm looking for would be:
.h
.m
Then of course the identifiers need to be able to be compared between two card for the game I'm making, say if two cards are of the same suit, they interact and an event occurs because of it...
is this sort of stuff possible? I'm sure it is, some guidance on what to put in the header file would be great thanks.
.h
Code:
UIImageView *card
UIImage *image;
@property (nonatomic, retain) UIImageView *card;
.m
Code:
card.image = image;
card.suit = clubs;
//or
card.suit = diamonds;
Then of course the identifiers need to be able to be compared between two card for the game I'm making, say if two cards are of the same suit, they interact and an event occurs because of it...
Code:
if (card1.suit == card2.suit) {
//magical things happen
}
is this sort of stuff possible? I'm sure it is, some guidance on what to put in the header file would be great thanks.