-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
contentInset not suitable with iOS7 #147
Comments
ios7 have problem too, do you change it? |
same problem here? any ideas to fix this properly? |
i fix it like this: |
I test it with iOS7. It seems the work around by @kyo9999 can fix this problem. The problem was caused by iOS7 automaticallyAdjustsScrollViewInsets property. The default value of this property is YES. Simply disable it like this can also fix this problem. Remeber to check ios version if your need to support earlier ios version. - (void)viewDidLoad
{
[super viewDidLoad];
self.automaticallyAdjustsScrollViewInsets = NO;
// Some other code...
} |
Beautiful! Thanks @fanyj, I wasn't looking forward to debugging that one! |
Nice @fanyj :-) |
It just work for the first time, but after the first pull the contentInset is broken again |
Strange - I'm finding the opposite. I was only ever having the problem on the first pull prior to this fix, and now I don't have it at all. |
@sqlumee As a side-effect, my solution disable the "automaticallyAdjustsScrollViewInsets" behavior. You may need to set contentInset manully after your view loaded. - (void)viewDidLoad
{
[super viewDidLoad];
// Manully set contentInset.
UIEdgeInset currentInset = self.tableView.contentInset;
currentInset.top = self.navigationController.navigationBar.bounds.size.height;
if (SYSTEM_VERSION_HIGHER_OR_EQUAL_THAN(@"7.0")) {
self.automaticallyAdjustsScrollViewInsets = NO;
// On iOS7, you need plus the height of status bar.
currentInset.top += STATUS_BAR_HEIGHT;
}
self.tableView.contentInset = currentInset;
// Some other code...
} Additonally, try it on the lastest commit. |
is it going to be fixed in SVPullToRefresh? or something we have to do in each VC since now? |
@fanyj , nice solution, but I found set - (void)startAnimating{
// if(fequalzero(self.scrollView.contentOffset.y) {
if(fequalzero(self.scrollView.contentOffset.y + self.originalTopInset)){
// [self.scrollView setContentOffset:CGPointMake(self.scrollView.contentOffset.x, -self.frame.size.height) animated:YES];
[self.scrollView setContentOffset:CGPointMake(self.scrollView.contentOffset.x, -(self.frame.size.height+self.originalTopInset)) animated:YES];
self.wasTriggeredByUser = NO;
}
else
self.wasTriggeredByUser = YES;
self.state = SVPullToRefreshStateLoading;
} Don't forget |
scrollView's
|
@sagiwei A good sloution, It works for my project. |
Is this going to be fixed in the main repo? |
@fanyj is worked in iOS 7. THX |
Here is what I do:
Basically,It's same with @fanyj ,but you don't care about the contentInsets.Also you can deselect "Under The Top Bar" in Attributes Inspector from you storyboard or nib file. |
I used @sagiwei fixed. |
if we set automaticallyAdjustsScrollViewInsets we can modify the code as below |
if we set automaticallyAdjustsScrollViewInsets = YES we can modify the code as below |
@fanyj thanks for Solving My Problem. Only one line Solved My Issue (dance). |
I've solved by the way @fanyj said. But when I call - (void)viewDidLoad {
[super viewDidLoad];
// Manully set contentInset.
UIEdgeInsets currentInset = self.tableView.contentInset;
currentInset.top = self.navigationController.navigationBar.bounds.size.height;
//if (SYSTEM_VERSION_HIGHER_OR_EQUAL_THAN(@"7.0")) {
self.automaticallyAdjustsScrollViewInsets = NO;
// On iOS7, you need plus the height of status bar.
CGRect rcStatus=[[UIApplication sharedApplication] statusBarFrame];
currentInset.top += rcStatus.size.height;
// }
self.tableView.contentInset = currentInset;
//self.edgesForExtendedLayout = UIRectEdgeNone; |
@gclsoft see my comment above, same problem. |
+1 for sagiwei's comment from Sep 24, 2013. Manually triggering pull to refresh wasn't working for me until I modified those lines. |
@sagiwei Thanks. |
contentInset not suitable with iOS7
The text was updated successfully, but these errors were encountered: