【发布时间】:2012-05-15 18:06:21
【问题描述】:
我有一个UITableView,它最初在屏幕外,当按下按钮时,我将视图的中心点向右移动,将表格视图移回屏幕上。类似于 Facebook 中的菜单。
//Slide in Side Menu
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:.75];
self.view.center = CGPointMake((cgSize.width/2)+10, 165);
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView commitAnimations];
我的问题是,当我的表格视图的左上角是负数(屏幕外)时,didSelectRowAtIndexPath 不会触发并且由于某种原因禁用了选择。
menuTableView = [[UITableView alloc] initWithFrame:CGRectMake(-350, 0, 350, cgSize.height-50)
style:UITableViewStylePlain];
当我将 -350 更改为 0 时,它可以完美运行,如下所示:
menuTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 350, cgSize.height-50)
style:UITableViewStylePlain];
有什么想法吗?
【问题讨论】:
-
当你在做这个时 menuTableView = [[UITableView alloc] initWithFrame:CGRectMake(-350, 0, 350, cgSize.height-50) style:UITableViewStylePlain]; ,你的整个框架应该是不可见的,如何按下表格单元格?
标签: objective-c ios ipad uitableview didselectrowatindexpath