Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How do I pad a UITableView horizontally from the edges of screen?

$
0
0

I am Subclassing the DialogViewController to have a consistent look and feel for my Dialog TableViews

public class ThemedDialogViewController : DialogViewController
{
    public ThemedDialogViewController  (UITableViewStyle style, RootElement root, bool pushing) 
        : base (style, root, pushing) 
    {
    }

    public override void LoadView () 
    {
        base.LoadView ();

                    this.TableView.ContentInset = new UIEdgeInsets (0f, 10f, 0f, 10f);
        this.TableView.BackgroundView = null;
        this.TableView.BackgroundColor = UIColor.FromRGB(233f/255f,128f/255f,35f/255f);
    }

}

I am trying to evenly space the tableview 10 from the sides of the window, but this only sets the tableview in 10 from the left, the right remains unchanged. I realized that there was an extra 10 to the right of the table however. Which leads me to believe I actually need to shrink the width of the table somehow. I tried to do this in the subclass but it had no effect: this.TableView.Frame = new RectangleF(0,0,this.TableView.Bounds.Size.Width-60, this.TableView.Bounds.Size.Height);

However, I did try the above in the DialogViewController ViewDidLoad and it worked but there was a jumping effect in the UI which I of course do not want.

Any ideas on how to achieve this? Much appreciated.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>