2010-06-01 89 views
0

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


} 

该应用程序的作品,朝鲜蓟的翻转视图显示了杏子的信息。

一直在努力了两天。我一直在使用iPhone应用程序两个月,非常感谢任何有关此问题的帮助。

非常感谢。

回答

0

看起来像我需要使用NSDictionay,而不是一个NSArray做到这一点。所以,我会再试一次。

+0

我想通了。我们必须制作一个tableView类,mainView类和一个flipView类。 tableView-didSelectRowAtIndex方法推送到mainView。 mainView类必须创建翻转机制,我使用了modalTransitionalStyle方法。 flipView包含后退按钮方法。 – 2010-09-14 17:58:12