iphone - 通过 UIButton 将 UITableViewController 移回顶部

标签 iphone ios xcode ipad uitableview

我正在尝试创建一个长 UITableView,我想要一个按钮,允许用户通过按下表格底部的按钮返回到表格顶部。 我可以知道它怎么能这样做吗?

-(IBAction) goUp (id) 发件人{ ????代码????

谢谢

最佳答案

UITableView 是 UIScrollView 的子类,所以调用 setContentOffset:animated: 像这样:

CGPoint topOffset = CGPointMake(0, 0);
[tableView setContentOffset:topOffset animated:YES];

关于iphone - 通过 UIButton 将 UITableViewController 移回顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10156212/

相关文章:

ios - Swift Alamofire 映射器

swift - 忽略标志指针 0x10ef76ec0 : no flag found at that address in Xcode 的 RegisterValidateFunction()

ios - 是否可以通过 UI 测试中的代码返回 "toggle software keyboard"?

iphone - viewcontroller 中 appdelegate 和 delegate 的区别

cocoa-touch - 测试应用内购买时使用哪个帐户?

android - 如何使用 PhoneGap 包装现有的 iOS 应用程序

ios - 如何在 iOS 中解码 NSURL?

objective-c - 替换、移动 NSMutableArray 中的对象

ios - 如何在 iOS 应用程序中减小谷歌地图的屏幕尺寸

iphone - UITabBarController 的编程创建和配置 - 为选项卡设置系统图像