diff --git a/MonoTouch.Dialog/ActivityElement.cs b/MonoTouch.Dialog/ActivityElement.cs index a527213b..a7d4665f 100644 --- a/MonoTouch.Dialog/ActivityElement.cs +++ b/MonoTouch.Dialog/ActivityElement.cs @@ -10,7 +10,8 @@ public class ActivityElement : UIViewElement, IElementSizing { ((UIActivityIndicatorView) View).StartAnimating (); var sbounds = UIScreen.MainScreen.Bounds; var vbounds = View.Bounds; - View.Frame = new RectangleF ((sbounds.Width-vbounds.Width)/2, 4, vbounds.Width, vbounds.Height + 8); + View.Frame = new RectangleF ((sbounds.Width-vbounds.Width)/2, 4, vbounds.Width, vbounds.Height + 0); + View.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin; } public bool Animating { diff --git a/MonoTouch.Dialog/Controls.cs b/MonoTouch.Dialog/Controls.cs index fd9dba8f..bf12cd3b 100644 --- a/MonoTouch.Dialog/Controls.cs +++ b/MonoTouch.Dialog/Controls.cs @@ -58,6 +58,8 @@ internal class RefreshTableHeaderView : UIView { public RefreshTableHeaderView (RectangleF rect) : base (rect) { + this.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; + BackgroundColor = new UIColor (0.88f, 0.9f, 0.92f, 1); lastUpdateLabel = new UILabel (new RectangleF (0, rect.Height - 30, 320, 20)){ Font = UIFont.SystemFontOfSize (13f), @@ -66,7 +68,8 @@ public RefreshTableHeaderView (RectangleF rect) : base (rect) ShadowOffset = new SizeF (0, 1), BackgroundColor = this.BackgroundColor, Opaque = true, - TextAlignment = UITextAlignment.Center + TextAlignment = UITextAlignment.Center, + AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin }; AddSubview (lastUpdateLabel); @@ -78,6 +81,7 @@ public RefreshTableHeaderView (RectangleF rect) : base (rect) BackgroundColor = this.BackgroundColor, Opaque = true, TextAlignment = UITextAlignment.Center, + AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin }; AddSubview (statusLabel); SetStatus (RefreshViewStatus.PullToReload); @@ -85,13 +89,15 @@ public RefreshTableHeaderView (RectangleF rect) : base (rect) arrowView = new UIImageView (new RectangleF (20, rect.Height - 65, 30, 55)){ ContentMode = UIViewContentMode.ScaleAspectFill, Image = arrow, + AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin }; arrowView.Layer.Transform = CATransform3D.MakeRotation ((float) Math.PI, 0, 0, 1); AddSubview (arrowView); activity = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.Gray) { Frame = new RectangleF (25, rect.Height-38, 20, 20), - HidesWhenStopped = true + HidesWhenStopped = true, + AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin }; AddSubview (activity); } diff --git a/MonoTouch.Dialog/DialogViewController.cs b/MonoTouch.Dialog/DialogViewController.cs index 70e76be0..e59c8f0a 100644 --- a/MonoTouch.Dialog/DialogViewController.cs +++ b/MonoTouch.Dialog/DialogViewController.cs @@ -140,6 +140,15 @@ public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientat return Autorotate; } + public override void DidRotate (UIInterfaceOrientation fromInterfaceOrientation) + { + base.DidRotate (fromInterfaceOrientation); + + //JON DID THIS + this.ReloadData(); + } + + Section [] originalSections; Element [][] originalElements; diff --git a/MonoTouch.Dialog/Elements.cs b/MonoTouch.Dialog/Elements.cs index 45be2418..9fd68088 100644 --- a/MonoTouch.Dialog/Elements.cs +++ b/MonoTouch.Dialog/Elements.cs @@ -1182,7 +1182,7 @@ public TimeElement (string caption, DateTime date) : base (caption, date) public override string FormatDate (DateTime dt) { - Console.WriteLine (dt.ToShortTimeString () + " - " + dt.ToLongTimeString ()); + //Console.WriteLine (dt.ToShortTimeString () + " - " + dt.ToLongTimeString ()); return dt.ToLocalTime ().ToShortTimeString (); } @@ -1284,7 +1284,7 @@ public class Section : Element, IEnumerable { public List Elements = new List (); // X corresponds to the alignment, Y to the height of the password - internal SizeF EntryAlignment; + public SizeF EntryAlignment; /// /// Constructs a Section without header or footers. @@ -1677,7 +1677,7 @@ public class RootElement : Element, IEnumerable { internal Group group; public bool UnevenRows; public Func createOnSelected; - internal UITableView TableView; + public UITableView TableView; /// /// Initializes a RootSection with a caption diff --git a/MonoTouch.Dialog/LoadMoreElement.cs b/MonoTouch.Dialog/LoadMoreElement.cs index 27c721bf..099b36fa 100644 --- a/MonoTouch.Dialog/LoadMoreElement.cs +++ b/MonoTouch.Dialog/LoadMoreElement.cs @@ -34,6 +34,9 @@ public LoadMoreElement (string normalCaption, string loadingCaption, NSAction ta cell = new UITableViewCell(UITableViewCellStyle.Default, "loadMoreElement"); + if (this.tapped == null) + cell.SelectionStyle = UITableViewCellSelectionStyle.None; + activityIndicator = new UIActivityIndicatorView(); activityIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray; activityIndicator.Hidden = true; @@ -62,13 +65,16 @@ public override UITableViewCell GetCell (UITableView tv) public override void Selected (MonoTouch.Dialog.DialogViewController dvc, UITableView tableView, NSIndexPath path) { tableView.DeselectRow(path, true); - - caption.Text = this.LoadingCaption; - activityIndicator.Hidden = false; - activityIndicator.StartAnimating(); - Layout(); - - System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(Tapped)); + + if (this.tapped != null) + { + caption.Text = this.LoadingCaption; + activityIndicator.Hidden = false; + activityIndicator.StartAnimating(); + Layout(); + + System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(Tapped)); + } } public float GetHeight (UITableView tableView, NSIndexPath indexPath) @@ -89,10 +95,11 @@ void Layout() { float h = UIScreen.MainScreen.Bounds.Height; float width = UIScreen.MainScreen.Bounds.Width; + width = cell.ContentView.Bounds.Width; - float captionHeight = 0.0625f * h; - float topPadding = 0.02083f * h; + float captionHeight = 0.04166f * h; + float topPadding = 0.03125f * h; float itemPadding = 0.01042f * h; var size = cell.StringSize(caption.Text, font, width - captionHeight - topPadding, UILineBreakMode.TailTruncation); diff --git a/MonoTouch.Dialog/MonoTouch.Dialog.csproj b/MonoTouch.Dialog/MonoTouch.Dialog.csproj index 92cba92a..0b167695 100644 --- a/MonoTouch.Dialog/MonoTouch.Dialog.csproj +++ b/MonoTouch.Dialog/MonoTouch.Dialog.csproj @@ -54,6 +54,32 @@ False iPhone Developer + + none + false + bin\iPhoneSimulator\Release + prompt + 4 + False + None + + + none + false + bin\iPhone\Release + prompt + 4 + False + iPhone Developer + + + none + false + bin + 4 + False + iPhone Developer + @@ -74,6 +100,8 @@ + +