I want to decrease the speed of UITableView scroll speed.
I've tried using decelerationRate property.
I changed this property to UIScrollViewDecelerationRateNormal and UIScrollViewDecelerationRateFast but couldn't feel the change.
I couldn't figure out any other way to decrease the scroll speed.
Does anyone have a solution?
Related
I have a UITableView with Custom UITableViewCell's. The Cell's can vary between 200.0 and 300.0 and height.
Now if you open Facebook, you'll notice the scrolling in the News Feed is awfully choppy. However, this is likely due to that various videos that are loaded on every cell, and that the time taken in cellForRowAtIndexPath is greater than 13.67ms (1s/60frames). Hence the choppy 'flicker'.
Quora on the other hand has cells that are varying heights, between probably 150.0 and 400.0+. It scrolls pretty smoothly however.
Now, when I scroll my tableView it's as though my screen is 'jumping'. I will scroll down, and every now and then (may every new cell dequeue but not quite), it's as if something higher up in the tableview got a few pixels shorter in height, and therefore the screen i'm currently viewing jumped up a few pixels. (This is not what's happening, I'm just trying to paint a picture of what it looks like).
Now I know it's not a time related issue. My cellForRowAtIndexMethod is nowhere near 13.67ms. It's always around 3ms, so that's not the issue.
2 questions...
1) Is this typically indicative of an auto layout issue?
2) Is there an accurate/semi-accurate way to calculate estiamtedRowHeight when you have such varied cell heights, or would having an accurate number here not fix this issue anyway? Just an idea.
I want to see the UITableView sliding performance, like scroll velocity, memory occupy etc. Can Xcode Profiler do this? Give some numbers or graphics?
I am having a problem with UITableView, that has a UIImageView as a subview of UITableViewCell. When I set it's layer's corner property, the UITableView scroll becomes less smooth.
Yes you can use Instruments to collect the CPU and memory usage. You may refer to this document.
In your particular case, you first collect CPU usage. Then you expand the method named scrollViewDidScroll and cellForRowAtIndexPath, and check if any CPU demanding lines. Typically you have to complete each call within 16ms so as to maintain smooth animation at 60fps.
I'm having problem solving how to get an effect like Duolingo's carousel scrolling of content. The effect is that the card in the middle would be the largest with ones on the sides some in and out as it
Has anyone done this or have an idea?
You can start by implementing some of the UIScrollViewDelegate methods. scrollViewDidScroll: will provide you with continuous events during the scroll and you should be able to calculate the scale of the buttons/images from this point.
I'm trying to implement horizontal parallax on a paging scroll view which makes it so that one view appears to advance faster in the x direction but "lands" in the same spot (for example, say (0,0)). Here is my general setup / view hierarchy:
(transparent scroller, which intercepts / passes through scroll
events)
(object overlay that I want to move 1.2x pace in the x
direction, but doesn't surpass it's "landing spot")
(another overlay that I want to move at a 1.0x pace in the x
direction)
I know it has to do something with modifying the contentOffset and I have my delegates all setup so that they can all move at the 1x pace in the same direction...any hints as to the solution?
If you want to keep your current setup all you need to do is use the -(void)scrollViewDidScroll:(UIScrollView *)scroller delegate method with your scroller that is tracking the scroll events. In this method you will track the content offset and then use your speed multipliers to move your other views the way you want them to.
However you can easily do this with just 2 scrollviews, and when one moves you track its contentOffset in the same -(void)scrollViewDidScroll:(UIScrollView *)scroller delegate method and move the other accordingly.
Furthermore, if the two scrollviews are of different sizes, a natural parallax effect is incredibly easy to achieve tracking the contentOffset in the -(void)scrollViewDidScroll:(UIScrollView *)scroller delegate method and then using the value and the scrollview's contentSize to get a percentage of how far the scrollview moved and then simply set the contentOffset of the secondary scrollview to scroll that percentage of it's contentSize.
Let me know if you need further explanation.
Scenario:
Horizontally scrolling UIScrollView with reused page views (so that there are only few page viewcontrollers which are being reused similar way like UITableView cells). So that they are able to be updated with new content and reused I need to know exact position of UIScrollView's content view (offset). This works great.
Now I need to implement custom scrolling animation - I mean to programatically move the content view, so that user touches some buttons, and the scroll view scrolls to desired position with this custom animation. The movement can be very quick and very far. I can not use Core Animation for this, as I could not track position during animation (CA reports you only start and end of the movement). So I decided to use CADisplayLink, and calculate each UIScrollView content for each position. This works great too.
The only problem is, that sometimes I see stroboscopic effect - say I am moving the content to the right, and it looks like it is moving to left. If I look at builtin animation within UISCrollView using setContentOffset:animated:, the animation is smooth and nice. Does anyone know, how to get rid of this stroboscopic effect?
Most likely your issue is that timestamp is a double and you're assigning it to a float
Floats have 7 digits while Doubles have 15-16 digits.
So in other words you're experiencing data loss. By using double you should see a silky smooth animation.