我有一个从网络服务器提取的随机调查表。我需要执行一个按钮 (setNeedsDisplay) 来刷新页面...当我点击错误按钮时应用程序崩溃了:
*由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[ExercisesViewController setNeedsDisplay]:无法识别的选择器发送到实例 0x6a1e840”
*** 首先抛出调用堆栈:
(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
actionselector(markButtonSelected forControlEvents:UIControlEventTouchUpInside];
[scrollView addSubview:mark];
...
- (IBAction)markButtonSelectedid)sender{
[self performSelectorInBackgroundselector(setNeedsDisplay) withObject:nil];
}
这是语法问题吗?我读了here它与线程有关。有人可以解释一下线程还是有更直接的方法?
提前谢谢...
Best Answer-推荐答案 strong>
setNeedsDisplay 方法是UIView 的方法,而不是UIViewController 。在您的 markButtonSelected: 方法中只需添加: [self.view setNeedsDisplay];
关于iphone - 刷新 View Controller .m,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/10333917/
|