0
My problem is this: my application has a screen that uses the Uitableviewcontroller layout. I created a header (View) for this screen, however, the header does not get fixed at the top of the screen. That is, when I drag the screen up/down, the header also moves up/down. My question is is is there any way to keep a subView fixed at the top of the screen, this subView is in Uitableviewcontroller?
ps.: I tried this solution but it didn’t work.
override func scrollViewDidScroll (scrollView: UIScrollView) {
var fixedFrame: CGRect = self.uiTopView.frame;
fixedFrame.origin.y = scrollView.contentOffset.y;
self.uiTopView.frame = fixedFrame;
}
You have two options: if your table has only one section, try setting the style of your table as Plain and create a
UIView
customized. If you have multiple sections, it is not possible with aUITableViewController
, then you’ll need to have oneUIViewController
and separately create your header and table.– Paulo Rodrigues