【发布时间】:2009-08-23 04:08:52
【问题描述】:
如果我尝试为 tableView(例如:height -= 200)的帧高度设置动画,则最后 200px 中出现的单元格会在帧的平滑动画完成之前突然消失。
为了确保我没有做任何其他事情,我创建了一个新的基于视图的应用程序。在主要的viewController 中,我创建了自己的tableview,其中的pseudo rows 足以填满整个屏幕。在选择一行时,我会做一个简单的高度动画。
最相关的代码:
- (void)viewDidLoad {
[super viewDidLoad];
self.myTable = [[[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)] autorelease];
myTable.delegate = self;
myTable.dataSource = self;
[self.view addSubview:myTable];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
CGRect frame = self.myTable.frame;
frame.size.height = 200;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDelay:.5f];
[UIView setAnimationDuration:0.5f];
self.myTable.frame = frame;
[UIView commitAnimations];
}
有谁知道为什么会发生这种情况,或者可能有什么修复/解决方法?
非常感谢任何建议。 蒂亚!
【问题讨论】:
标签: objective-c iphone uitableview