我有一个从网络服务器提取的随机问卷表格。我需要执行一个按钮(setNeedsDisplay)来刷新页面......当我点击按钮时应用程序崩溃了:
*Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ExercisesViewController setNeedsDisplay]: unrecognized selector sent to instance 0x6a1e840' *** First throw call stack: (0x13f3022 0x1584cd6 0x13f4cbd 0x1359ed0 0x1359cb2 0x963054 0x974fc6 0x57c0 0x13f4e99 0x4014e 0x400e6 0xe6ade 0xe6fa7 0xe6266 0x301a1a 0x13c799e 0x135e640 0x132a4c6 0x1329d84 0x1329c9b 0x12dc7d8 0x12dc88a 0x3d626 0x1f96 0x1f05) 终止称为抛出异常*
//Add refreshing agenda
scrollViewFrame = CGRectMake(0, 200, 80, 40);
mark = [UIButton buttonWithType:UIButtonTypeRoundedRect];
mark.frame = scrollViewFrame;
[mark setTitle:@"Get Score" forState:UIControlStateNormal];
[mark setBackgroundColor:[UIColor clearColor]];
[mark addTarget:self
action:@selector(markButtonSelected:) forControlEvents:UIControlEventTouchUpInside];
[scrollView addSubview:mark];
...
- (IBAction)markButtonSelected:(id)sender{
[self performSelectorInBackground:@selector(setNeedsDisplay) withObject:nil];
}
这是语法问题吗?我在这里读到它与线程有关。有人可以解释一下线程还是有更直接的方法?提前谢谢...