Having problem loading data from AppDelegate using UITableView into a flip view, loads first view bu
- by Ms. Ryann
AppDelegate:
@implementation Ripe_ProduceGuideAppDelegate
-(void)applicationDidFinishLaunching:(UIApplication *)application {
Greens *apricot = [[Greens alloc] init];
apricot.produceName = @"Apricot";
apricot.produceSight = @"Deep orange or yellow orange in appearance, may have red tinge, no marks or bruises. ";
apricot.produceTouch = @"Firm to touch and give to gentle pressure, plump.";
apricot.produceSmell = @"Should be Fragrant";
apricot.produceHtoP = @"raw, salads, baked, sauces, glazes, desserts, poached, stuffing.";
apricot.produceStore = @"Not ripe: place in brown paper bag, at room temperature and out of direct sunlight, close bag for 2 - 3 days. Last for a week. Warning: Only refrigerate ripe apricots.";
apricot.produceBest = @"Spring & Summer";
apricot.producePic = [UIImage imageNamed:@"apricot.jpg"];
Greens *artichoke = [[Greens alloc] init];
artichoke.produceName = @"Artichoke";
artichoke.produceSight = @"Slightly glossy dark green color and sheen, tight petals that are not be too open, no marks, no brown petals or dried out look. Stem should not be dark brown or black.";
artichoke.produceTouch = @"No soft spots";
artichoke.produceSmell = @" Should not smell";
artichoke.produceHtoP = @"steam, boil, grill, saute, soups";
artichoke.produceStore = @"Stand up in vase of cold water, keeps for 2 -3 days. Or, place in refrigerator loose without plastic bag. May be frozen, if cooked but not raw.";
artichoke.produceBest = @"Spring";
artichoke.producePic = [UIImage imageNamed:@"artichoke.jpg"];
self.produce = [[NSMutableArray alloc] initWithObjects:apricot, artichoke, nil];
[apricot release];
[artichoke release];
FirstView:
@implementation ProduceView
-(id)initWithIndexPath: (NSIndexPath *)indexPath {
if (self == [super init] ){
index = indexPath;
}
return self;
}
-(void)viewDidLoad {
Ripe_ProduceGuideAppDelegate *delegate = (Ripe_ProduceGuideAppDelegate *)
[[UIApplication sharedApplication] delegate];
Greens *thisProduce = [delegate.produce objectAtIndex:index.row];
self.title = thisProduce.produceName;
sightView.text = thisProduce.produceSight;
touchView.text = thisProduce.produceTouch;
smellView.text = thisProduce.produceSmell;
picView.image = thisProduce.producePic;
}
FlipView:
@implementation FlipsideViewController
@synthesize flipDelegate;
-(id)initWithIndexPath: (NSIndexPath *)indexPath {
if ( self == [super init]) {
index = indexPath;
}
return self;
}
-(void)viewDidLoad {
Ripe_ProduceGuideAppDelegate *delegate = (Ripe_ProduceGuideAppDelegate *)
[[UIApplication sharedApplication] delegate];
Greens*thisProduce = [delegate.produce objectAtIndex:index.row];
self.title = thisProduce.produceName;
bestView.text = thisProduce.produceBest;
htopView.text = thisProduce.produceHtoP;
storeView.text = thisProduce.produceStore;
picView.image = thisProduce.producePic;
}
*the app works, the flip view for Artichoke shows the information for Apricot. Been working on it for two days. I have been working with iPhone apps for two months now and would very much appreciate any assistance with this problem. Thank you very much.