Hi,
I'm pulling my hair out trying to figure out why my label and button text aren't being set.
The following code is an extract from my QuizViewController.m file.
Q is a label (NSString) <IBOutlet>
btnA, btnB, btnC are round rect buttons <IBOutlet>
currentQuestion is a property (NSSring object)
currentQuestion was set as @"Q1" by the prepareForSegue method from the previous viewController.
The compiler is saying that there is no property answerA in class Answer WHEN THERE IS!
Also, the build will success if I replace Answer.answerA with a direct string, but when testing, the labels and buttons do appear empty.
PLEASE help.
Thanks
Rob
I'm pulling my hair out trying to figure out why my label and button text aren't being set.
The following code is an extract from my QuizViewController.m file.
Q is a label (NSString) <IBOutlet>
btnA, btnB, btnC are round rect buttons <IBOutlet>
currentQuestion is a property (NSSring object)
currentQuestion was set as @"Q1" by the prepareForSegue method from the previous viewController.
Code:
NSMutableDictionary *questions;
NSMutableDictionary *answers;
- (void)viewDidLoad
{
[super viewDidLoad];
[questions setObject:@"A 57 year old male presented to the out of hours GP service having splashed a oven cleaner in his left eye. His work colleagues irrigated his eye in the sink and have driven him promptly to see you. After instillation of proxymetacaine, his visual acuity was 6/9." forKey:@"Q1"];
[answers setObject:@"Fax a referral and send the patient home." forKey:@"1A"];
[answers setObject:@"Start chloramphenicol and arrange Ophthalmic follow up in the morning." forKey:@"1B"];
[answers setObject:@"Irrigate the eye copiously checking PH every 15-30 minutes." forKey:@"1C"];
Q.text = [questions objectForKey:currentQuestion];
Answer *a1 = [[Answer alloc] init];
a1.answerA = [answers objectForKey:@"1A"];
a1.answerB = [answers objectForKey:@"1B"];
a1.answerC = [answers objectForKey:@"1C"];
[btnA setTitle:[Answer.answerA] forState:UIControlStateNormal];
[btnB setTitle:[Answer.answerB] forState:UIControlStateNormal];
[btnC setTitle:[Answer.answerC] forState:UIControlStateNormal];
}
The compiler is saying that there is no property answerA in class Answer WHEN THERE IS!
Also, the build will success if I replace Answer.answerA with a direct string, but when testing, the labels and buttons do appear empty.
PLEASE help.
Thanks
Rob
Last edited: