开发者

Black Translucent Nav Bar / UITableView / Content Inset / Scroll Position Issues

I'm implementing a UITableView that has the index along the right hand size as well as section headers. I'm essentially implementing a stock NSFetchedResultsController as depicted in Apple's docs. The UITableView is contained within开发者_C百科 a UINavigationController with a Black Translucent Nav Bar. I have the top content and scroller insets set to 44 to compensate for the Nav Bar overlap of the table. Even with the insets set, I'm having a few problems using a UITableView in a Black Translucent Nav Bar which I believe are related.

When I touch an item in the index column to bring me to that section, the section header 'hangs' at the correct spot (butted up right below the nav bar) but the first cell appears to be shifted up one. I'm thinking the table isn't aware of the nav bar overlap, so it's positioning the first cell where it would go if the header was at the top of the window frame but below the header (if that makes sense). It's difficult to explain so I'm attaching a screenshot to help illustrate. The first 'Billy' that's hidden should be in the location of the second billy that's flush below the section header 'B'.

(oops, too big of a noob to post images. http://dontgoplastic.com/temp/uitableview.png )

The second issue has to do with the same table but in regards to selectRowAtIndexPath:animated:scrollPosition:. If I try to use 'UITableViewScrollPositionNone' for 'scrollPosition' and set the indexPath to something that's below the current visible screen, it shifts the table down (as expected), but short what I'm assuming is 44 pixels. Again, I think the table thinks that the cell is in view, but isn't taking into account the inset.

Hopefully I'm just overlooking a simple property.

Thanks for your time


I'm still not 100% what's going wrong, but I'm able to correct it by subclassing UITableView and editing setContentOffset:animated: like so:

- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated {
CGPoint newOffset = CGPointMake(contentOffset.x, contentOffset.y - 44);
[super setContentOffset:newOffset animated:animated];
}

Hope this either helps shed some light on my problem or helps someone else out with a possible solution.

Thanks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜