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應用程序兩個月,非常感謝任何有關此問題的幫助。
非常感謝。
我想通了。我們必須製作一個tableView類,mainView類和一個flipView類。 tableView-didSelectRowAtIndex方法推送到mainView。 mainView類必須創建翻轉機制,我使用了modalTransitionalStyle方法。 flipView包含後退按鈕方法。 – 2010-09-14 17:58:12