Я в настоящее время пытается, чтобы сделать викторину на iphone, поэтому я увидел учебник, но, похоже, xcode не понимает мой plist или что-то еще: мои ярлыки пустые, когда я запускаю его: in мой .m-файл:Извлечь информацию из plist
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
questionNumber = 0;
NSString * path = [[NSBundle mainBundle] pathForResource:@"Propriety List" ofType:@"plist"];
if (path) {
NSDictionary *tempDict = [[NSDictionary alloc] initWithContentsOfFile: path];
self.Question = [tempDict objectForKey:@"Root"];}
currentQuestion = -1;
}
-(void) showNextQuestion {
currentQuestion++;
if (currentQuestion < [self.Question count]) {
NSDictionary *nextquestion = [self.Question objectAtIndex:currentQuestion];
self.Answear = [nextquestion objectForKey:@"QuestionAnswear"];
self.labelQuestionTitle.text = [nextquestion objectForKey:@"QuestionTitle"];
self.labelAnswearA.text = [nextquestion objectForKey:@"A"];
self.labelAnswearB.text = [nextquestion objectForKey:@"B"];
self.labelAnswearC.text = [nextquestion objectForKey:@"C"];
self.labelAnswearD.text = [nextquestion objectForKey:@"D"];
self.labelAnswearE.text = [nextquestion objectForKey:@"E"];
}
else {
// Game over
}
}
- (IBAction)buttonPressedA:(id)sender{
if ([self.Answear isEqualToString:@"A"]) {
numCorrect++;
NSLog(@"%d", numCorrect);
}
Конечно, я только что надел соответствующие коды, а не все. Может кто-нибудь помочь пожалуйста ??
Что вы можете получить, если вы зарегистрируете tempDict? – rdelmar
Как я могу это сделать? (Спасибо за быстрый ответ!) – lea51294
NSLog (@ "% @", tempDict); – rdelmar