Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView scrolls beyond the bounds of my uiview

In my view, I added another view (named popupview) for custom popover like animation.

In the popupview, I have added a table view and have set some bounds to the table view, but the table view height doesn't change, whatever height I set in the xib.

There is another problem that when scrolling in the tableview, it scrolls out of the view even if the tableview is inserted in the popup view.

There are no issues with the image I have used. It has the same height, width as the second uiview popupview.

XIB Structure:

View1 mainView - table view

View 1

View2 PopupView {Orange View}

View 2

TableView2 - table in popup view

TableView 2

like image 884
iOS dev Avatar asked Mar 24 '23 09:03

iOS dev


1 Answers

Try setting the "popupview" view's clipsToBounds property to YES. This should prevent the "sticking out" of the table-view, if the frame of the table-view is greater/not the same as the frame of your "popupview".

But aside from that, the proper way:

Have you experimented with the Autosizing/Autoresizing-Mask settings of your views? Your table-view is a subview (i.e. child) of your popupview, right? so the table-views frame should scale (i.e. autoresize) to the parrent views frame (popupview)! You can configure this behavior either in IB in the "Size Inspector" pane of your table-view or programmatically. You should check out the View Programming Guide for IOS.

like image 125
Nenad M Avatar answered Mar 30 '23 01:03

Nenad M