Reputation: 544
When I slowly pull down to refresh, I see the UIActivityIndicator circle slowly get more complete before it starts the refresh. Just before the circle is complete and the refresh actually triggers, the content jumps/jerks down and then the circle starts spinning. I only notice this when I pull down slowly.
I'm using the pull to refresh inside a scroll view called mainSV
self.refresh = [[UIRefreshControl alloc] init];
[self.refresh addTarget:self action:@selector(handleRefresh) forControlEvents:UIControlEventValueChanged];
[self.mainSV addSubview:self.refresh];
Why does this jump/jerk happen?
Upvotes: 12
Views: 6287
Reputation: 12292
I found a strange bug or misbehavior. Have a scroll view which scrolls both H and V.
In storyboard turn on bounce. Look at the two redundant checkboxes bounce horizontally/vertically. If you turn on only one of those:
when you pull down in bounce a long way in the scroll view, you'll get weird jump back to zero for two frames, ie a flicker.
So long as the two redundant checkboxes bounce horizontally/vertically are both either on or off, the issue goes away.
This happens in many-not-all HV scrollviews. I just wasted an hour of my life stumbling on the way to stop the problem so I haven't investigated it further.
This is ios 17 Xcode 15. For far future readers the issue is likely cleared.
Note that this may be a simulator-only problem.
Upvotes: -1
Reputation: 9
Old questions but if someone still has this issue and you are using NavigationController just make your NavigationBar "Translucent".
Using non translucent NavigationBar causes the tableview to jump slightly when UIControlEventValueChanged is fired for some reason.
XCode 10.1
Upvotes: -1
Reputation: 35
I would need to see the rest of your code (or at least the scrolling + refreshing methods) to diagnose the problem.
Here's our tutorial for implementing custom pull to refresh controls in objective-c and swift. If you follow this tutorial you shouldn't see any jumping or jerking.
http://www.jackrabbitmobile.com/design/ios-custom-pull-to-refresh-control/
Hope it helps!
Upvotes: -1
Reputation: 3799
I suspect the jump/jerk is due to a "double" action.
There was a change to refresh
implementation following the release of Xcode 5.
As such, the requirement to set a target action as described in the Apple Documentation is no longer necessary.
As you are using a Storyboard, in your Interface Builder / Storyboard file, select your storyboard scene (table view controller).
In the attributes inspector, under the subheading Table View Controller, select the item "Refreshing" and change the setting from "Disabled" to "Enabled".
Delete or comment out the three lines of code you have included in your question. (When it was required, i.e. prior to Xcode 5, I placed this code in my viewDidLoad
TVC lifecycle method.)
If not automatically inserted into your code, then add this as either a public or private IBAction
...
- (IBAction)refresh:(UIRefreshControl *)sender;
and wire to your scene / table view controller to the Sent Event "Value Changed".
Ensure your refresh action is properly configured...
- (IBAction)refresh:(UIRefreshControl *)sender {
[self.refreshControl beginRefreshing];
// Refresh code for your TVC
[self.refreshControl endRefreshing];
}
Note that no property is required to be set for refreshControl
- I suspect there is a trigger to automatically synthesise this when you choose the setting Refreshing [Enabled] in your TVC attributes in the storyboard.
If you need to call the refresh from in your code, use this line...
[self refresh:self.refreshControl];
Upvotes: 3
Reputation: 5655
It's probably a bug in iOS. Your setup is correct, and I see the same thing in my app.
Upvotes: 9