views:

138

answers:

0

I am trying to use data from my plist in my table view and subview. the table view works fine and everything loads. But I cant get the data into the subview.

My app is based around apples advance table cell download

My RootViewControllerPoints.m

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [data count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"ApplicationCell";

    ApplicationCell *cell = (ApplicationCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

#if USE_INDIVIDUAL_SUBVIEWS_CELL
        [[NSBundle mainBundle] loadNibNamed:@"IndividualSubviewsBasedApplicationCell" owner:self options:nil];
        cell = tmpCell;
        self.tmpCell = nil;

#endif
    }

 // Display dark and light background in alternate rows -- see tableView:willDisplayCell:forRowAtIndexPath:.
    cell.useDarkBackground = (indexPath.row % 2 == 0);

 // Configure the data for the cell.

    NSDictionary *dataItem = [data objectAtIndex:indexPath.row];
    cell.icon = [UIImage imageNamed:[dataItem objectForKey:@"Icon"]];
    cell.publisher = [dataItem objectForKey:@"Publisher"];
    cell.name = [dataItem objectForKey:@"Name"];


    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    return cell;
}




- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
 NextViewController *nextController = [[NextViewController alloc] initWithNibName:@"NextView" bundle:nil];
 nextController.dataItem = [data objectAtIndex:indexPath.row];
 [self.navigationController pushViewController:nextController animated:YES];
 [nextController release]; 
}
@end

My NextViewController.h

@interface NextViewController : UIViewController
{
 NSDictionary *dataItem;
 UILabel *nameLabel;
 UIImageView *iconView;


}

@property (nonatomic, retain) NSDictionary *dataItem;
@property (nonatomic, retain) IBOutlet UILabel *nameLabel;
@property (nonatomic, retain) IBOutlet UIImageView *iconView;


@end

and my NextViewController.m

#import "NextViewController.h"


@implementation NextViewController

@synthesize nameLabel,dataItem, iconView;


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

- (void)dealloc
{
    [super dealloc];
}

@end

all text and images to load up in the tale view, or the individual subviews inside the table. but just cant get them into the subviews once they are clicked on.

my individualsubviewsbasedapplication.m is

#import "IndividualSubviewsBasedApplicationCell.h"


@implementation IndividualSubviewsBasedApplicationCell

- (void)setBackgroundColor:(UIColor *)backgroundColor
{
    [super setBackgroundColor:backgroundColor];


}

- (void)setIcon:(UIImage *)newIcon
{
    [super setIcon:newIcon];
    iconView.image = newIcon;
}

- (void)setPublisher:(NSString *)newPublisher
{
    [super setPublisher:newPublisher];
    publisherLabel.text = newPublisher;
}


- (void)setName:(NSString *)newName
{
    [super setName:newName];
    nameLabel.text = newName;
}



- (void)dealloc
{
    [iconView release];
    [publisherLabel release];
    [nameLabel release];
    [priceLabel release];

    [super dealloc];
}

@end

Any ideas? im probably missing somthing really obvious, but i've hacked at the code that much, Its probably a mistake on my part.

Thanks