How can I discard 2 choices out of 4 from my Array of choice
Posted
by Umaid
on Stack Overflow
See other posts from Stack Overflow
or by Umaid
Published on 2010-05-17T08:40:22Z
Indexed on
2010/05/19
5:40 UTC
Read the original article
Hit count: 140
iphone
Actually I have four choice out of which i need to discard to choice on button click like 50/50 , then it will show only 2 choice for user to select out which one is correct and one is wrong
-(IBAction)Rebind:(id)sender {
if (i == [QuizArray count]) {
if([sender tag] == 1)
//if([sender tag] == 1)
{
[self.CorrectArr addObject:@"A"];
//[self.CorrectArr addObject:mydiet.varOpt1];
}
else if([sender tag] == 2)
{
[self.CorrectArr addObject:@"B"];
//[self.CorrectArr addObject:mydiet.varOpt2];
}
else if([sender tag] == 3)
{
[self.CorrectArr addObject:@"C"];
//[self.CorrectArr addObject:mydiet.varOpt3];
}
else if([sender tag] == 4)
{
[self.CorrectArr addObject:@"D"];
//[self.CorrectArr addObject:mydiet.varOpt4];
}
Score *myscore = [[Score alloc] initWithNibName:@"Score" bundle:nil];
myscore.SelectedArr = CorrectArr;
[self.view addSubview:myscore.view];
}
else
{
NSString *questionstring = [NSString stringWithFormat:[[QuizArray objectAtIndex:i] varQuestion]];
self.myquestion.text = questionstring;
[btn1 setTitle:[[AnswerArray objectAtIndex:i] varAnswer] forState:normal];
if([sender tag] == 1)
{
[self.CorrectArr addObject:@"A"];
//addObject:mydiet.varOpt1];
}
else if([sender tag] == 2)
{
[self.CorrectArr addObject:@"B"];
//addObject:mydiet.varOpt2];
}
else if([sender tag] == 3)
{
[self.CorrectArr addObject:@"C"];
//addObject:mydiet.varOpt3];
}
else if([sender tag] == 4)
{
[self.CorrectArr addObject:@"D"];
//addObject:mydiet.varOpt4];
}
}
i = i + 1;
//}
}
© Stack Overflow or respective owner