spro / TwitterProfileClone

Swift clone of Twitter's iOS profile view with a stretchy header
44 stars 6 forks source link

SegmentedControl shifts when updating UITableView #2

Open acegreen opened 8 years ago

acegreen commented 8 years ago

With our current implementation if lets say you add more rows to the UITableView

The segmentedControl will shift downwards because the added rows call scrollViewDidScroll which calls out delegate.

To reproduce, just have the button add more objects to the ProfileUpdate()

Append indexPaths:

newIndexPaths.append(NSIndexPath(forRow: self.tradeIdeas.count - 1, inSection: 0)) And then

self.tableView.insertRowsAtIndexPaths(newIndexPaths, withRowAnimation: .None)

acegreen commented 8 years ago

Bump

spro commented 8 years ago

Thanks for the bump I didn't see this the first time around...

I just added a small commit @ https://github.com/spro/TwitterProfileClone/commit/64e1be5702898ac17c72bcdbd23fc9a6eba894ca making that button add a new row to the top. It doesn't seem to be causing any issues for me... do you have the inner view set up differently?

acegreen commented 8 years ago

@spro no worries, still running into this issue.

Take a look at the video below. Specifically what happens when I scroll down and load more rows into my tableView

http://recordit.co/k3iARHbwzI

spro commented 8 years ago

I tried with a navigation bar (thinking it could be related to automaticallyAdjustsScrollViewInsets) and with a RefreshControl (thinking it caused some extraneous scroll event) but I'm not able to reproduce it. Can you make sure you have this view hierarchy:

And the ContainerViewController (which is just named "ViewController" in my implementation) is what you'd push into a UINavigationController.

If all else fails could you send a minimal code sample that reproduces this so I can poke around?