views:

810

answers:

2

I have created a view in interface builder that contains another view (content area) and a button bar at the bottom.

The hierarchy is as:

->View
--->mapContainer UIView
----->map MKMapView
----->OverlayView UIView
--->ToolBar UIToolBar

I would like the mapContainer to resize to full window when the ToolBar is hidden. I would like the map and the OverlayView to resize to the mapContainer size

I have attempted the following code, but it has no effect. Please advise?

public override void ViewDidLoad ()
{
  base.ViewDidLoad ();
  this.mapContainer.AutosizesSubviews = true ;
  this.View.AutosizesSubviews = true ;
  try
  {
    this.mapContainer.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth ;
    this.map.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth ;
    this.map.SizeToFit();
    this.mapContainer.SizeToFit();
    this.map.SizeToFit();
    this.View.Frame = new System.Drawing.RectangleF(0,0,this.View.Frame.Width, this.View.Frame.Height );
    this.mapContainer.LayoutSubviews();

  }
  catch(Exception ex)
  {
    Console.Write(ex.ToString());
  }
}
A: 

Check out this article may be this can help you.Its not related to monotouch but it will give nice concept of how to arrange elements together in IB. http://programmingobsession.blogspot.com/2009/05/real-world-iphone-rotation-part-1.html

Shoaib Shaikh
A: 

Your mask creation is flawed: you need to use C style OR operators, which are two bars: ||, not one bar |

Mr. John