UITableView framework getting reset value in nib

I have a UITableView for which I am dynamically setting the Frame so that it can be sorted by number of items. I do this so that the tableview can be "nudged" down by dragging from the top of the phone. UITableView is defined within the element for the view.

Whenever the view containing this sliding UITableView disappears (as when calling viewDidDisappear) the UITableView Frame gets reset to the nib value (which I set to 44, the size of the static footer).

My question has two parts:

  • Why does the Frame get reset, and what mechanism is it that resets the Frame?
  • How can I ensure that whenever the Frame gets reset to the nib value, I can set the Frame to the size I want?

In the background, I've run out of every possible lifecycle method.

It is interesting to note that I tried to set the Frame to ViewDidAppear, which gets hit when my "error" is played and for which I checked Frame.Height is the desired value at the end of the method, although when the pins are dropped at the end, the frame height is still 44. Is the tableView IBOutlet I am not a bump that is actually loaded into the view?

    public override void ViewDidAppear (bool animated)
    {
        RetractMemoryTableAnimation(0);

        // Frame is correct after this line (Height > 44)
        // But the Frame in my view persists to a height of 44
        this.tableView.Frame = new RectangleF(this.tableView.Frame.Location.X, this.tableView.Frame.Location.Y,
                                              this.tableView.Frame.Size.Width, this.CalculatedTableViewHeightWithFooter);
    }

      

+3


source to share


1 answer


When writing custom code to set a frame, UIView

always set AutoresizingMask

to UIAutoresizingMask.None

if the view seems to be getting auto-resized.



+4


source







All Articles