Hi guys
I used the code to try set the label text but its not working. I though maybe I forgot to connect the outlet with the label, or i connected the wrong outlet but they were ok once I checked them. Made sure the xib was saved.
.m
@synthesize nameLabel;
@synthesize infoLabel;
-(void) updateUI
{
nameLabel.text = @"test1";
infoLabel.text = @"test2";
}
.h
UILabel * nameLabel;
UILabel * infoLabel;
@property(nonatomic, retain) IBOutlet UILabel *nameLabel;
@property(nonatomic, retain) IBOutlet UILabel *infoLabel;
Thats pretty much all the code used in the veiw controller related to these labels. Is there something i am missing that might explain this strangeness?
The default text i have in the labels 'name' & 'info' is what is showing.
This is the code that gets called prior to updateUI being called
browseDeckViewController.m
-(void) viewDidLoad
{
cardOnTopOfDeck = 0;
cardSecondFromTopOfDeck=1;
deck = [[Deck alloc] init];
[deck loadDeckData];
Card *mySecondCard = [[Card alloc] init];
mySecondCard = [deck.deckArray objectAtIndex:cardSecondFromTopOfDeck];
secondCard = [[CardViewController alloc] initWithNibName:@"CardViewController"
bundle:[NSBundle mainBundle] numberOfStats:kNumStats];
[secondCard setCard:mySecondCard];
CGRect frame = secondCard.view.frame;
frame.origin.x = (320-frame.size.width)/2;
frame.origin.y = 10;
secondCard.view.frame = frame;
[self.view addSubview:secondCard.view];
topCard = [[CardViewController alloc] initWithNibName:@"CardViewController"
bundle:[NSBundle mainBundle] numberOfStats:kNumStats];
Card *myTopCard = [[Card alloc] init];
myTopCard = [deck.deckArray objectAtIndex:cardOnTopOfDeck];
[topCard setCard:myTopCard];
frame = topCard.view.frame;
frame.origin.x = (320-frame.size.width)/2;
frame.origin.y = 10;
topCard.view.frame = frame;
[self.view addSubview:topCard.view];
}
CardViewController.m
-(void) setCard:(Card *)newCard
{
[card release];
card = [newCard retain];
[self updateUI];
}
-(void) updateUI
{
NSLog(@"updateUI");
nameLabel.text = @"test1";
infoLabel.text = @"test2";
}