2010-06-01 3 views
0

AppDelegate:Avoir des données de chargement de la difficulté de AppDelegate à l'aide UITableView en vue flip, les charges première vue, mais pas la vue flip

@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; 


} 

L'application fonctionne, la vue flip pour Artichoke montre les informations pour Abricot.

Travailler dessus pendant deux jours. Je travaille avec des applications iPhone depuis deux mois et j'apprécierais beaucoup toute aide avec ce problème.

Merci beaucoup.

Répondre

0

semble que j'ai besoin d'utiliser un NSDictionay et non un NSArray pour ce faire. Donc, je vais essayer à nouveau.

+0

Je l'ai compris. Il faut créer une classe tableView, une classe mainView et une classe flipView. La méthode tableView-didSelectRowAtIndex pousse à mainView. La classe mainView que vous avez pour créer le mécanisme de retournement, j'ai utilisé l'approche modalTransitionalStyle. Le flipView contient les méthodes du bouton de retour. –

Questions connexes