ios - Adding a UIView to a TableViewControllers view -
i have tableviewcontroller , in created uiview programatically width , height of status bar , has colored background. basically, serves status bar's background:
let statusbarbg = uiview(frame: cgrectmake(0, 0, widthofscreen, 20)) statusbarbg.backgroundcolor = uicolor... self.view.addsubview(statusbarbg) however, when drag table , down status bar background moves entire table view, seen in following image (on left how looks normally, bigger section of red nav bar's bg):

so question is: how create view inside tableviewcontroller more sibling tableview rather child moves it? thanks.
how create view inside tableviewcontroller more sibling tableview rather child moves it?
unfortunately not possible tableviewcontroller, because view of tableviewcontroller uitableview instance, in turn subclass of uiscrollview. , put child of scrollview scrolls it.
a better approach move away using tableviewcontroller, , use normal view controller embedded table view instead. can reuse view controller adding heirarchy.
another (easier) approach handle scroll delegate method of uitableview, , adjust header view's y position according offset.
Comments
Post a Comment