iOS 开发实用技术导航
NSHipster 中文版
› http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
› http://www.cocos2d-iphone.org/
CocoaPods
› http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
› http://code.google.com/mobile/analytics/
WWDC
› https://developer.apple.com/wwdc/
Design Guides and Resources
› https://developer.apple.com/design/
Transcripts of WWDC sessions
› http://asciiwwdc.com
Cocoa with Love
› http://cocoawithlove.com/
Cocoa Dev Central
› http://cocoadevcentral.com/
NSHipster
› http://nshipster.com/
Style Guides
› Google Objective-C Style Guide
› NYTimes Objective-C Style Guide
Useful Tools and Services
› Charles Web Debugging Proxy
› Smore
zhlooking
V2EX  ›  iDev

知乎 iOS App 里,发现->推荐,推荐里面上半部分轮播的图片是如何随着 TableView 的滚动的?

  •  
  •   zhlooking · May 19, 2016 · 4463 views
    This topic created in 3819 days ago, the information mentioned may be changed or developed.
    13 replies  •  2016-06-16 16:47:49 +08:00
    hyzjshwo
    hyzjshwo
    May 19, 2016
    1
    我没实现过这样的,不过我可能会尝试 UIScrollview + UITableview ,应该可以实现吧
    hyzjshwo
    hyzjshwo
    May 19, 2016
    2
    好像有简单的方法
    zhlooking
    zhlooking
    OP
    May 19, 2016
    3
    @hyzjshwo 谢谢 :) UIScrollView 内嵌套 UITableView 实现起来确实很蛋疼……简单的方法是?
    wj2061
    wj2061
    May 19, 2016
    4
    scrollview 先设好 frame , 然后设成 tableview 的 tableHeaderView
    enjoeq
    enjoeq
    May 19, 2016
    5
    我能想到的是整个就是一个 tableview ,只是把 tableview 的 contentInset 和 indicatorInset 设为轮播图片的 view 的高度,然后再 observe tableview 的 contentOffset ,当 tableview 的 cell 向上滚动超过界限时就修改轮播图片的 origin.y ,并且同时修改 tableview 的 contentInset 和 indicatorInset 直到 0 ,大概就是这样的思路吧,不过只是猜想而已,没有实际尝试过,有错误请指正,谢谢。
    cbspapapa
    cbspapapa
    May 19, 2016
    6
    https://github.com/cbsfly
    可以参考我 github 里面知乎日报的实现或者轮播广告的 demo
    zhlooking
    zhlooking
    OP
    May 19, 2016
    7
    @wj2061 @cbspapapa 因为 headerView 被下拉控件占了,所以设置 headerView 不行啊。
    @enjoeq 嗯,大概思路就是这样的。:)
    kitalphaj
    kitalphaj
    May 20, 2016
    8
    @zhlooking 如果 headerView 不行,就可以考虑把第一个 cell 设置成轮播。我在几个 App 里面都实现过,思路很清晰也很简单。
    kobe1941
    kobe1941
    May 20, 2016
    9
    @kitalphaj 第一个不能是 tableView 的一个单独的 cel ,你看它的下拉刷新控件的位置是在轮播图片的下方。

    @enjoeq 看起来像是这样,注意到在往上滑动的过程中,轮播图片未完全出来时,滑动的进度条有被手动修改
    bloodshed
    bloodshed
    May 23, 2016
    10
    tableViewHeader
    hulz413
    hulz413
    Jun 11, 2016
    11
    我给 UIScrollView 加了个 category ,实现了无限轮播的功能,有需要可以参考下: https://github.com/hulizhen/HLZInfiniteScrollView
    fhefh
    fhefh
    Jun 16, 2016
    12
    mark~~
    fhefh
    fhefh
    Jun 16, 2016
    13
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1571 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 23:10 · PVG 07:10 · LAX 15:10 · JFK 18:10
    ♥ Do have faith in what you're doing.