Question

I was debugging quite an issue where tapping the status bar would not scroll a UITableView to the top. I checked scrollsToTop and it was set to yes, so naturally I started looking to see if any UIViews were on top of it.

The culprit was a UIView I bring in that is the same size as the UIViewController's view. I didn't think to check there because when I logged it out, it said it was nil.

Like so:

enter image description here

But then, when I call removeFromSuperView, scrolling to the top of the UITableView works perfectly! Here:

enter image description here

I triple checked and this is the only UIView that is over the top of the scrollbar, so what gives? It says it is null either way. I am using ARC as well. I am guessing I am wanting nil here, not null. I was thinking if I set it to nil, it would put the retain count to 0 under ARC. Perhaps there is still a reference to the view somewhere?

Was it helpful?

Solution

Setting the settingsView to nil does not remove it from its superview. It just nils out your reference to it. ARC or no ARC, the superview is retaining the settingsView so it's still covering your status bar unless you explicitly remove it. You could try changing the frame so it no longer covers the status bar.

I would recommend you try SparkInspector ( http://www.sparkinspector.com/ ). It is fantastic for solving these sorts of issues.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top