我在iOS 7上测试了我的应用程序并认识到我的“拉动刷新”(ODRefreshControl https://github.com/Sephiroth87/ODRefreshControl)不再起作用了。
我必须将scrollview拉得极远,才能看到微调器的一小部分和箭头图标。可能是什么问题呢。在iOS 5和iOS 6上,它完美无缺!!
答案 0 :(得分:5)
我在 ODRefreshControl.m 中只添加了一个值来修复iOS7的问题。也许从app到app的价值有点不同!
<强> BEFORE:强>
- (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;
}
<强> AFTER:强>
- (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;
}