我application
就像与测验有关,在我看来,我有 1 个图像视图和 4 个UIbuttons
,最初我必须加载图像imageview
并以随机方式分配 4 个按钮标题,其中一个按钮应该是当前图像名称,如果用户单击按钮我想显示下一组按钮标题和新的image
-(IBAction)answersetting:(id)sender
{
int i=0;
UIButton *mybutton = (UIButton *)sender;
[mybutton addTarget:self action:@selector(submitGuess:)
forControlEvents:UIControlEventValueChanged];
if(mybutton.tag == 1||mybutton.tag == 2||mybutton.tag == 3||mybutton.tag == 4)
{
for(int loop = 0; loop<4;loop++)
{
animage.image=[UIImage imageNamed:[NSString stringWithFormat:@"%@.jpg",[imageary objectAtIndex:i]]];
name=[self convertToDisplayName:[imageary objectAtIndex:i]];
[mybutton setTitle:name forState:UIControlStateNormal];
NSLog(@"current image name :%@",name);
if ([mybutton.titleLabel.text isEqualToString:[imageary objectAtIndex:i]])
{
//titles equal
[self alertshow];
i++;
}
UIView *newView = [self.view viewWithTag:i];
if([newView isKindOfClass:[UIButton class]])
{
UIButton *newButton = (UIButton *)newView;
[newButton setTitle:name forState:UIControlStateNormal];
}
}
}
}
这无法执行我上面描述的内容。我应该对我的代码进行哪些更改?请帮助解决这个问题