Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试创建一个长 UITableView,我想要一个按钮,允许用户通过按下表格底部的按钮返回表格顶部。我可以知道它是怎么做到的吗?
-(IBAction) goUp (id) sender{ ??code???? }
谢谢
UITableView 是 UIScrollView 的子类,所以调用 setContentOffset:animated: 如下:
CGPoint topOffset = CGPointMake(0, 0); [tableView setContentOffset:topOffset animated:YES];
以另一种方式,您可以致电scrollToRowAtIndexPath:atScrollPosition:animated:
scrollToRowAtIndexPath:atScrollPosition:animated: