View Single Post
  #3 (permalink)  
Old April 25th, 2012, 01:36 PM
hughisheretoo hughisheretoo is offline
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default got an answer

Thanks for the response. My code is below. I also submitted this problem to the Apple Developers forum and I got a response. You probably would have found it too if I had included the code below.

The Apple response said there were two problems one I had a tag variable defined in my CardImageView class. And I was in effect setting that tag variable instead of the view tag.

Also in my definition of the DispCard I should have use CardImageView instead of UIView. I told them I got an error or that and they gave me the following syntax to use and it all worked successfully.

CardImageView * DispCard;
DispCard = (CardImageView *)[self.view viewWithTag:(5)];

Thanks for your response. You probably would have found the same.
hugh


Code:
#import "CardImageView.h"

@implementation CardImageView


- (id)initWithFrame:(CGRect)frame CardBase:(NSString *)cardBase andTag:(int) inTag {
    NSString * tImageName;
    
    self = [super initWithFrame:frame];
    if (self) {
        self.tag = inTag;
        self.userInteractionEnabled = YES;
        tImageName = [NSString stringWithFormat:@"%@.png",cardBase];
        self.image = [UIImage imageNamed:tImageName];
    }
    return self;
}

@end
Reply With Quote