V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
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
tsinghan
V2EX  ›  iDev

SVPullToRefresh 这个插件怎么修改 loading indicator 的位置

  •  
  •   tsinghan · 2015-05-28 09:37:57 +08:00 · 4001 次点击
    这是一个创建于 3227 天前的主题,其中的信息可能已经有所发展或是发生改变。

    https://github.com/samvermette/SVPullToRefresh

    默认的loading 位置在top 和 bottom, 但有时候顶部会有nav, 这时候loading就会被挡住,所以我想调整loading的位置,

    [tableView addPullToRefreshWithActionHandler:^{
    // prepend data to dataSource, insert cells at top of table view
    // call [tableView.pullToRefreshView stopAnimating] when done
    } position:SVPullToRefreshPositionBottom];

    发现这个方法的position可以改变位置,但是枚举只有top 和 bottonm, 没有其他值,
    应该怎么该?

    27 条回复    2015-06-05 11:12:54 +08:00
    Sunnyyoung
        1
    Sunnyyoung  
       2015-05-28 09:49:47 +08:00
    使用MJRefresh
    likid
        2
    likid  
       2015-05-28 09:52:46 +08:00
    手动改源码
    tsinghan
        3
    tsinghan  
    OP
       2015-05-28 09:56:03 +08:00
    @likid 我试着改源码 增加SVPullToRefreshPosition 这个枚举,但是 提示我file not found, 奇怪
    tsinghan
        4
    tsinghan  
    OP
       2015-05-28 09:57:12 +08:00
    @Sunnyyoung MJRefresh 能改indicator 的位置吗
    expkzb
        5
    expkzb  
       2015-05-28 09:58:53 +08:00
    应该是使用方式问题,进一步猜测,可能是lz添加tableView的方式有问题
    tsinghan
        6
    tsinghan  
    OP
       2015-05-28 10:00:18 +08:00
    @Sunnyyoung 奥 我在看它的demo
    tsinghan
        7
    tsinghan  
    OP
       2015-05-28 10:00:47 +08:00
    @expkzb 怎么讲? 我现在就是一个tableview上面有个nav
    icodesign
        8
    icodesign  
       2015-05-28 10:01:32 +08:00
    在 viewDidAppear 里面就不会被挡住
    zjia8765
        9
    zjia8765  
       2015-05-28 10:19:17 +08:00
    controller里设置一下 self.edgesForExtendedLayout = UIRectEdgeNone;
    tsinghan
        10
    tsinghan  
    OP
       2015-05-28 10:38:44 +08:00
    @zjia8765 试了一下 确实往下移了一点, 但还是被遮住了一部分
    tsinghan
        11
    tsinghan  
    OP
       2015-05-28 10:39:29 +08:00
    @icodesign 这是什么思路?
    zjia8765
        12
    zjia8765  
       2015-05-28 12:05:35 +08:00
    你的nav是原生的还是自定义的?执行过隐藏nav的操作吗
    tsinghan
        13
    tsinghan  
    OP
       2015-05-28 12:22:57 +08:00
    @zjia8765 原生的,没有隐藏过
    codeface
        14
    codeface  
       2015-05-28 12:32:50 +08:00
    为什么不用MJRefresh
    tsinghan
        15
    tsinghan  
    OP
       2015-05-28 12:41:34 +08:00
    @codeface 恩, 正在考虑改成MJRefresh
    pepsin
        16
    pepsin  
       2015-05-28 12:44:30 +08:00
    他有 custom view 的,可以改改。
    icodesign
        17
    icodesign  
       2015-05-28 13:09:15 +08:00
    @tsinghan 跟它的原理有关,设计到 contentInset, contentOffset 的更新时机,你去查查它的 issue 里面有讨论过
    xi_lin
        18
    xi_lin  
       2015-05-28 13:29:04 +08:00
    @tsinghan 我也从SVPullToRefresh换到MJRefresh上了。我记得SV之前在6p上位置有问题
    tsinghan
        19
    tsinghan  
    OP
       2015-05-28 14:07:28 +08:00
    @icodesign
    @pepsin 恩, 我去看看issue里面的问题
    tsinghan
        20
    tsinghan  
    OP
       2015-05-28 14:13:13 +08:00
    额 果然在issue里面发现了这个问题 https://github.com/samvermette/SVPullToRefresh/issues/235
    @icodesign
    Elethom
        21
    Elethom  
       2015-05-28 14:24:42 +08:00 via iPhone
    這種幾年前的東西⋯⋯遠沒有我寫的好用。

    像 @icodesign 說的,之前 iOS 7 到 iOS 8 之間還修改過一次 content inset 更新機制,大多數 refresh control 都跪了。當然大多數蠢貨設計師和工程師都不覺得那樣有什麼問題,即使是 Twitter 也用了我三倍還多的時間發佈解決這個問題的更新。
    icodesign
        22
    icodesign  
       2015-05-28 15:27:09 +08:00
    @Elethom 这个库的好处就是实现很轻巧
    tsinghan
        23
    tsinghan  
    OP
       2015-05-28 15:35:07 +08:00
    Elethom
        24
    Elethom  
       2015-05-28 15:44:42 +08:00   ❤️ 1
    @icodesign
    這時候我是不是應該淡淡的給一個 ˊ_>ˋ 這樣的表情加上一句「哦」呢。
    https://github.com/Elethom/PRRefreshControl
    至於 MJRefresh 我的評價就是一個詞「垃圾」,國內 apps 的 refresh control 一個比一個難用且難看真是多虧了這個庫了,基本的交互沒做好又加了那麼多並沒有什麼卵用的功能也是閒得不行。
    black
        25
    black  
       2015-05-28 17:46:58 +08:00
    @Elethom 哈哈哈哈,赞同得不行!
    SeanChense
        26
    SeanChense  
       2015-05-31 19:19:21 +08:00 via iPhone
    介个,nav 是半透明的 tableview 就是从顶部开始的,菊花就会被挡住。
    nav 不透明 tableview 就是从 nav 底部开始,菊花就不会被挡住。没有半透明需求,直接设成不透明就解决这个问题了 :)
    ibremn
        27
    ibremn  
       2015-06-05 11:12:54 +08:00
    关于MJRefresh那个。。赞同 @Elethom
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3340 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 00:42 · PVG 08:42 · LAX 17:42 · JFK 20:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.