Forum Xamarin.iOS

Dynamically resizing elements at runtime

PhilipMurrayPhilipMurray GBMember ✭✭

I have a TableView as part of a Autolayout Storyboard that is constrained. This tableview needs to be resized to fit its content that is loaded at runtime.

I am updating the Frame size of the TableView in the overridden ViewDidAppear method as below.

        public override void ViewDidAppear(bool animated)

            //Autosize the booking table to the content
            UpcomingBookingsTableView.Frame = new CGRect(UpcomingBookingsTableView.Frame.X, 

The problem I have is two fold.

1 - When simulator rotates the height of the TableView reverts to the original height from the storyboard and does not respect the new value from the ViewDidAppear method

2 - When the TableView resizes the content below it does not move with it even though there are constraints set that it should appear offset from the bottom of the table view.

Any idea how I can resolved these problems?


Best Answer


  • AlunRogersAlunRogers GBMember

    Hi, I'm getting the same issue as (2) in your original post, is there any chance you could elaborate on how you fixed it?

    Currently I have a CollectionView that's height is defined at runtime, however a label that should be 15dpi below is not moving with the size of the CollectionView


Sign In or Register to comment.