ODRefreshControl不再工作了

Dav*_*vis 3 ios uirefreshcontrol pull-to-refresh ios7

我在iOS 7上测试了我的App,并认识到我的"Pull to Refresh"(ODRefreshControl https://github.com/Sephiroth87/ODRefreshControl)不再适用了.

我必须将scrollview拉得极远,才能看到微调器的一小部分和箭头图标.可能是什么问题呢.在iOS 5和iOS 6上,它完美无缺!!

Dav*_*vis 5

我在ODRefreshControl.m中只添加了一个值来修复iOS7的问题.也许从app到应用程序的价值有点不同!

之前:

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([keyPath isEqualToString:@"contentInset"]) 
{
    if (!_ignoreInset) 
{
        self.originalContentInset = [[change objectForKey:@"new"] UIEdgeInsetsValue];
        self.frame = CGRectMake(0, -(kTotalViewHeight + self.scrollView.contentInset.top), self.scrollView.frame.size.width, kTotalViewHeight);
    }
    return;
}
Run Code Online (Sandbox Code Playgroud)

后:

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:     (NSDictionary *)change context:(void *)context
{

NSInteger iOS7Value = 60.0f;

if ([keyPath isEqualToString:@"contentInset"]) 
{
    if (!_ignoreInset) 
{
        self.originalContentInset = [[change objectForKey:@"new"] UIEdgeInsetsValue];

        if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
{

        self.frame = CGRectMake(0, -(kTotalViewHeight + self.scrollView.contentInset.top) + iOS7Value, self.scrollView.frame.size.width, kTotalViewHeight);

        } else {

            self.frame = CGRectMake(0, -(kTotalViewHeight + self.scrollView.contentInset.top), self.scrollView.frame.size.width, kTotalViewHeight);
        }
    }
    return;
}
Run Code Online (Sandbox Code Playgroud)