Monotouch auto resizing views in iphone
Posted
by Tim Bassett
on Stack Overflow
See other posts from Stack Overflow
or by Tim Bassett
Published on 2009-10-04T22:09:51Z
Indexed on
2010/05/12
18:04 UTC
Read the original article
Hit count: 156
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());
}
}
© Stack Overflow or respective owner