2012-11-21 37 views
1

我设置一个按钮动作是这样的:的UITableView setContentInset不工作

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:0.3]; 
[tableView setContentInset:UIEdgeInsetsMake(40, 0, 0, 0)]; 
[UIView commitAnimations]; 

但是,该的tableView不若contentSize.height > tableView.frame.size.height下移。 解决方案是什么?

+0

确定“'tableView'”不为NULL ... –

回答

3

你可以试试下面的代码:

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:0.3]; 
[tableView setContentInset:UIEdgeInsetsMake(40, 0, 0, 0)]; 
[tableView scrollRectToVisible:CGRectMake(0, 0, 320, 1) animated:YES]; 

[UIView commitAnimations]; 

可能会有所帮助。

+0

谢谢,太棒了! – Kid

+0

如果这是正确答案,则标记为已接受,以便其他人从中获益。 – spider1983

相关问题