简体   繁体   English

SWIFT-UITableView的数字滚动

[英]SWIFT - NUMERIC SCROLL for UITableView

In the Screen below I am trying to add a numeric indexing type of scroll if that makes any sense. 在下面的屏幕中,我尝试添加数字索引类型的滚动(如果有任何意义)。 I am looking to make the following cells represent page numbers so if one decides to scroll instead of search they can see which number they're up while scrolling? 我希望使以下单元格代表页码,因此,如果一个人决定滚动而不是搜索,他们可以看到滚动时显示的是哪个号码?

Any help is much appreciated. 任何帮助深表感谢。 Thank you in advance :D 预先谢谢你:D

在此处输入图片说明

  • for display on which number user is currently you have to find out tblView?.visibleCells which returns all visible cell yue its first object to display your index (or you can use minimum indexpath.row value from visibleCells) and this method should written in ScrollViewDidEndScroll delegate method 要显示用户当前所在的号码,您必须找出tblView?.visibleCells ,该tblView?.visibleCells返回所有可见单元格的第一个对象以显示索引(或者您可以使用visibleCells中的最小indexpath.row值),并且此方法应该用ScrollViewDidEndScroll编写委托方法

  • for going to any index(type in search box) you can use 可以使用任何索引(在搜索框中输入类型)

    let newIndex = NSIndexPath(forItem:2, inSection:0) as NSIndexPath tblView?.scrollToRowAtIndexPath(newIndex, atScrollPosition: UITableViewScrollPosition.Top, animated: true)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM