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;
}
该应用程序正常工作,朝鲜蓟的翻转视图显示了Apricot的信息。
已经工作了两天。我已经使用iPhone应用程序两个月了,非常感谢对此问题的任何帮助。
非常感谢你。
答案 0 :(得分:0)
看起来我需要使用NSDictionay而不是NSArray来执行此操作。所以,我会再试一次。