我需要具有自定义标题视图的表格视图。当我触摸这个标题视图时,我会让她调整大小。我有下一个代码(例如)类topBarViewController
:智能UITableView标题视图
topBarViewController类:
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.frame = CGRectMake(0, 0, 320, 48);
[self.view setBackgroundColor:[UIColor greenColor]];
UITapGestureRecognizer *singleFingerTap =
[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleSingleTap:)];
[self.view addGestureRecognizer:singleFingerTap];
}
- (void)handleSingleTap:(UITapGestureRecognizer *)recognizer
{
[UIView animateWithDuration:0.5 animations:^{
CGRect frame = self.view.frame;
frame.size.height+=50;
self.view.frame = frame;
} completion:^(BOOL finished) {
}];
}
然后我设置此视图作为我的表视图头视图。在触摸事件我碰到了下一个文字:
2014-10-05 01:00:07.580 UGTUMap[4715:1988098] -[UITransitionView handleSingleTap:]:
unrecognized selector sent to instance 0x7ff6d542a5f0
2014-10-05 01:00:07.586 UGTUMap[4715:1988098] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[UITransitionView handleSingleTap:]:
unrecognized selector sent to instance 0x7ff6d542a5f0'
找不到解决方案。有什么建议么?
显示在您创建'topBarViewController',并将它设置为表视图的标题代码视图。我的猜测是,你创建'topBarViewController',使用它的视图,但从来没有保持强大的引用视图控制器('topBarViewController'实例)。 – rmaddy 2014-10-04 21:38:29
@rmaddy谢谢你,强烈的参考是一个解决方案! – 2014-10-04 21:57:04