- Опитвам се да покажа въпроси в контролер за изглед, използвайки сценарии и когато потребителят щракне, показва отговор. Пренася го от контролера
за изглед към друг. Другият контролер за преглед само показва
отговора и има бутон за връщане назад. - И двата изглед контролера използват един и същ
клас. Потребителят може да превключва следващ и предишен от един низ към
друг в приложението от въпроса. - Когато щракна върху показване на отговор на първия въпрос, аз
мога да видя първия низ в масива с отговори, който казва хаха, но когато отида на следващия
въпрос и щракна върху показване на отговора, той казва същия отговор. - Свързах ib action showanswer, но изглежда няма ефект. Бутонът Показване на отговор отива към другия контролер за изглед
чрез последователност и също така има ib действие показване на отговор, свързано с него.
Така че въпросът ми е какво правя погрешно в ib action showAnswer? Ако подхождам погрешно към това приложение тип флаш карта, какво правя погрешно?
//
// BiologyViewController.m
// Biology
//
// Created by Jacob Brans on 6/6/13.
// Copyright (c) 2013 Jacob Brans. All rights reserved.
//
#import "BiologyViewController.h"
@interface BiologyViewController ()
@end
@implementation BiologyViewController
@synthesize labelsText;
@synthesize textView, textViewanswer1;
-(void)viewDidLoad {
[super viewDidLoad];
titles = [NSArray arrayWithObjects:// Time Together
@"What is Biology?",@"What is yo mamma?",nil];
step= 0;
textView.text = [titles objectAtIndex:step];
answers = [NSArray arrayWithObjects:// Time Together
@"lol",@"wow",nil];
textViewanswer1.text = [answers objectAtIndex:step];
labelsText.text = [NSString stringWithFormat:@"%d/%d", step+1, titles.count];
}
-(IBAction)showanswer:(id)sender{
textViewanswer1.text = [answers objectAtIndex:step];
}
-(IBAction) nextclicked:(id)sender{
// titles = [NSArray arrayWithObjects:@"iology is the scientific study of life. Bam",@"This works? Wow",@"lol", nil];
if (step<titles.count-1) {
step++;
}
else
{
step= 0;
}
textView.text = [titles objectAtIndex:step];
labelsText.text = [NSString stringWithFormat:@"%d/%d", step+1, titles.count];
}
-(IBAction) prevClicked:(id)sender{
// titles = [NSArray arrayWithObjects:@"Biology is the scientific study of life. Bam",@"This works? Wow",@"Still Works.",@"garret is the coolest awesome person awesome wowowowwwwwwwwwwwwwwwwwwwwwwwwwww", nil];
if (step>0) {
step--;
}
else
{
step =titles.count-1;
}
textView.text = [titles objectAtIndex:step];
labelsText.text = [NSString stringWithFormat:@"%d/%d", step+1, titles.count];
}
-(IBAction) randomClicked:(id)sender{
step = 1+arc4random() %(titles.count);
textView.text = [titles objectAtIndex:step];
labelsText.text = [NSString stringWithFormat:@"%d/%d", step+1, titles.count];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
step
(свойство,статична променлива)?? - person Roshan   schedule 07.06.2013