如何将标签添加到ODRefeshControl的底部

时间:2013-04-24 22:55:34

标签: objective-c xcode pull-to-refresh

在我使用Apples UIRefreshControl之前,我可以在Refresh Control的底部显示标签,如下所示:

UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
    [refreshControl addTarget:self action:@selector(addReceipt:)
             forControlEvents:UIControlEventValueChanged];
    self.refreshControl = refreshControl;

    NSString *s = @"Swipe Down to Add Receipt";
    NSMutableAttributedString *a = [[NSMutableAttributedString alloc] initWithString:s];
    [a addAttribute:NSForegroundColorAttributeName value:[UIColor darkGrayColor] range:NSRangeFromString(s)];
    refreshControl.attributedTitle = a;

现在我为自定义活动指示器切换到ODRefreshControl,我无法找到解决方案! 我的ODRefreshControl代码(只是为了它的工作):

ODRefreshControl *refreshControl = [[ODRefreshControl alloc] initInScrollView:self.tableView];
    [refreshControl addTarget:self action:@selector(dropViewDidBeginRefreshing:) forControlEvents:UIControlEventValueChanged];

1 个答案:

答案 0 :(得分:0)

看起来这种控件不支持开箱即用的这类东西。看一看代码,它似乎不支持attributedTitle或类似的东西。另外,我假设你正在使用这个控件:

https://github.com/Sephiroth87/ODRefreshControl

如果是这种情况,您可能有几个选择:

  1. 您必须自己在ODRefreshControl源代码中编写一些代码来添加标签,最有可能是initWithScrollView方法,但这可能不完全准确。
  2. 请开发人员在将来的版本中添加它(看来你已经这样做了。)
  3. 返回使用Apple Refresh控件。如果你想要一个标题标签,为什么你更喜欢ODRefreshControl
相关问题