本文整理汇总了C#中UITableView.SizeToFit方法的典型用法代码示例。如果您正苦于以下问题:C# UITableView.SizeToFit方法的具体用法?C# UITableView.SizeToFit怎么用?C# UITableView.SizeToFit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITableView
的用法示例。
在下文中一共展示了UITableView.SizeToFit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
// no XIB !
tableView = new UITableView()
{
Delegate = new TableViewDelegate(this),
DataSource = new TableViewDataSource(this),
AutoresizingMask = UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.White,
};
// Set the table view to fit the width of the app.
tableView.SizeToFit();
// Reposition and resize the receiver
tableView.Frame = new RectangleF (
0, 0, this.View.Frame.Width, this.View.Frame.Height);
// Add the table view as a subview
this.View.AddSubview(tableView);
Console.WriteLine("Is you're using the simulator, switch to it now.");
}
示例2: inizialize
void inizialize ()
{
if( horizontalTableView != null)
{
if(this.horizontalTableView.Source==null)
this.horizontalTableView.Source = new MyTableViewDelegate ();
}
else
{
horizontalTableView=new UITableView(new RectangleF(0,0,220,320))
{
AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.Yellow
};
horizontalTableView.SizeToFit();
//horizontalTableView.Frame = new RectangleF ( 0, 0, this.Frame.Width, this.Frame.Height );
this.horizontalTableView.Source = new MyTableViewDelegate ();
this.horizontalTableView.ShowsVerticalScrollIndicator=false;
}
this.AddSubview(horizontalTableView);
}
开发者ID:XamarinControls,项目名称:govindaraokondala-horizontal-scrolling-in-Table-in-IOS,代码行数:25,代码来源:HorizontalTableCell2.cs
示例3: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
_database = AppDelegate.SessionDatabase;
_sessions = _database.GetSessions(_date).ToList();
// no XIB !
tableView = new UITableView()
{
Delegate = new TableViewDelegate(this, _date, _sessions),
DataSource = new TableViewDataSource(this, _date, _sessions),
AutoresizingMask = UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.White,
};
// Set the table view to fit the width of the app.
tableView.SizeToFit();
// Reposition and resize the receiver
tableView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height);
// Add the table view as a subview
this.View.AddSubview(tableView);
}
示例4: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
Console.Write("Total categories {0} ", rootmvc.Categories.Categories.Count);
showCategories = rootmvc.Categories.GetRange (start, end);
Console.WriteLine (" range ({0},{1}) items {2}", start,end,showCategories.Count);
// no XIB !
tableView = new UITableView()
{
Delegate = new TableViewDelegate(showCategories, rootmvc),
DataSource = new TableViewDataSource(showCategories, rootmvc),
AutoresizingMask = UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.White,
};
// Set the table view to fit the width of the app.
tableView.SizeToFit();
// Reposition and resize the receiver
tableView.Frame = new RectangleF (
0, 0, this.View.Frame.Width, this.View.Frame.Height);
// Add the table view as a subview
this.View.AddSubview(tableView);
}
示例5: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
this.Title = "Contacts";
list = new List<Contact>();
//
// get the address book, which gives us access to the
// the contacts store
//
var book = new AddressBook ();
//
// important: PreferContactAggregation must be set to the
// the same value when looking up contacts by ID
// since we look up contacts by ID on the subsequent
// ContactsActivity in this sample, we will set to false
//
book.PreferContactAggregation = true;
//
// loop through the contacts and put them into a List
//
// contacts can be selected and sorted using linq!
//
// In this sample, we'll just use LINQ to grab the first 10 users with mobile phone entries
//
foreach (Contact contact in book.Where(c => c.Phones.Any(p => p.Type == PhoneType.Mobile)).Take(10))
{
list.Add(contact);
}
//
// create a tableview and use the list as the datasource
//
tableView = new UITableView()
{
Delegate = new TableViewDelegate(this),
DataSource = new TableViewDataSource(list),
AutoresizingMask =
UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
};
//
// size the tableview and add it to the parent view
//
tableView.SizeToFit();
tableView.Frame = new RectangleF (
0, 0, this.View.Frame.Width,
this.View.Frame.Height);
this.View.AddSubview(tableView);
}
示例6: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
#region load data from XML
RogetHierarchy hierarchy;
using (TextReader reader = new StreamReader("roget15aHierarchy.xml"))
{
XmlSerializer serializer = new XmlSerializer(typeof(RogetHierarchy));
hierarchy = (RogetHierarchy)serializer.Deserialize(reader);
// HACK: makes Divisions synonymous with Sections, makes navigation easier
foreach (var h in hierarchy.Classes)
{
foreach (RogetDivision d in h.Divisions)
{
h.Sections.Add(new RogetSection{Name=d.Name, Sections = d.Sections});
}
}
}
Classes = hierarchy.Classes;
using (TextReader reader = new StreamReader("roget15aCategories.xml"))
{
XmlSerializer serializer = new XmlSerializer(typeof(RogetCategories));
Categories = (RogetCategories)serializer.Deserialize(reader);
}
#endregion
// no XIB !
tableView = new UITableView()
{
Source = new TableViewSource (Classes, this),
//Delegate = new TableViewDelegate(Classes, this),
//DataSource = new TableViewDataSource(Classes, this),
AutoresizingMask = UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.White,
};
// Set the table view to fit the width of the app.
tableView.SizeToFit();
// Reposition and resize the receiver
tableView.Frame = new RectangleF (
0, 0, this.View.Frame.Width, this.View.Frame.Height);
// Add the table view as a subview
this.View.AddSubview(tableView);
Console.WriteLine("Is you're using the simulator, switch to it now.");
}
示例7: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
list = new List<TableItem> () { };
var path = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
DirectoryInfo dr = new DirectoryInfo(path);
FileInfo [] f = new FileInfo [10];
f = dr.GetFiles();
foreach (var file in f) {
TableItem t = new TableItem();
t.Heading = file.Name;
// t.SubHeading = file.FullName;
t.ImageName = @"\Images\Icons\114_icon.png";
list.Add(t);
}
tableview = new UITableView();
tableview.Source = new TableSource(list);
tableview.AutoresizingMask = UIViewAutoresizing.FlexibleHeight|UIViewAutoresizing.FlexibleWidth;
// Set the table view to fit the width of the app.
tableview.SizeToFit();
// Reposition and resize the receiver
tableview.Frame = new RectangleF (
0, 0, this.View.Frame.Width,
this.View.Frame.Height);
// Add the table view as a subview
this.View.AddSubview(tableview);
Console.Write("If you're using the simulator, ");
Console.WriteLine("switch to it now.");
}
示例8: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
// no XIB !
navBar = new UINavigationBar();
navBar.PushNavigationItem (new UINavigationItem("Choose Location"), false);
navBar.BarStyle = UIBarStyle.Black;
navBar.Frame = new RectangleF(0,0,this.View.Frame.Width,45);
navBar.TopItem.RightBarButtonItem = new UIBarButtonItem("Done",UIBarButtonItemStyle.Bordered, delegate {FlipController.Flip();});
tableView = new UITableView()
{
Delegate = new TableViewDelegate(this, _locations),
DataSource = new TableViewDataSource(this, _locations),
AutoresizingMask = UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
Frame = new RectangleF (0, 45, this.View.Frame.Width, this.View.Frame.Height-44)
, TableHeaderView = navBar
};
// Set the table view to fit the width of the app.
tableView.SizeToFit();
// Reposition and resize the receiver
tableView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height);
// Add the table view as a subview
this.View.AddSubview(tableView);
/*
Console.WriteLine("make flip button");
var flipButton = UIButton.FromType(UIButtonType.InfoDark);
flipButton.Frame = new RectangleF(290,10,20,20);
flipButton.Title (UIControlState.Normal);
flipButton.TouchDown += delegate {
FlipController.Flip();
};
Console.WriteLine("flipbutton created");
this.View.AddSubview(flipButton);
*/
}
示例9: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
if(_tents == null)
{
_tents = new TentInfoRepository("tents.xml").GetAll();
}
_tableView = new UITableView
{
Delegate = new TableViewDelegate(this, _tents),
DataSource = new TableViewDataSource(_tents),
AutoresizingMask = UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.White,
ScrollEnabled = true,
Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height)
};
_tableView.SizeToFit();
this.View.AddSubview(_tableView);
}
示例10: ViewDidLoad
// add this string to the extra arguments for mtouch
// -gcc_flags "-framework QuartzCore -L${ProjectDir} -lAdMobSimulator3_0 -ObjC"
public override void ViewDidLoad()
{
base.ViewDidLoad ();
checkForRefresh = false;
reloading = false;
list = new List<string>()
{
"Tangerine",
"Mango",
"Grapefruit",
"Orange",
"Banana"
};
tableView = new UITableView()
{
Delegate = new TableViewDelegate(list),
DataSource = new TableViewDataSource(list),
AutoresizingMask =
UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
//BackgroundColor = UIColor.Yellow,
};
// Set the table view to fit the width of the app.
tableView.SizeToFit();
// Reposition and resize the receiver
tableView.Frame = new RectangleF (
0, 0, this.View.Frame.Width,
this.View.Frame.Height);
RefreshTableHeaderView refreshHeaderView = new RefreshTableHeaderView();
refreshHeaderView.BackgroundColor = new UIColor (226.0f,231.0f,237.0f,1.0f);
tableView.AddSubview (refreshHeaderView);
// Add the table view as a subview
this.View.AddSubview(tableView);
tableView.DraggingStarted += delegate {
checkForRefresh = true;
};
tableView.Scrolled += delegate(object sender, EventArgs e) {
if (checkForRefresh) {
if (refreshHeaderView.isFlipped && (tableView.ContentOffset.Y > - 65.0f) && (tableView.ContentOffset.Y < 0.0f) && !reloading)
{
refreshHeaderView.flipImageAnimated (true);
refreshHeaderView.setStatus (TableViewPullRefresh.RefreshTableHeaderView.RefreshStatus.PullToReloadStatus);
}
else if ((!refreshHeaderView.isFlipped) && (this.tableView.ContentOffset.Y < -65.0f))
{
refreshHeaderView.flipImageAnimated (true);
refreshHeaderView.setStatus(TableViewPullRefresh.RefreshTableHeaderView.RefreshStatus.ReleaseToReloadStatus );
}
}
};
tableView.DraggingEnded += delegate(object sender, EventArgs e) {
if (this.tableView.ContentOffset.Y <= -65.0f){
reloading = true;
//Reload your data here
refreshHeaderView.toggleActivityView();
UIView.BeginAnimations("ReloadingData");
UIView.SetAnimationDuration(0.2);
this.tableView.ContentInset = new UIEdgeInsets (60.0f,0.0f,0.0f,0.0f);
UIView.CommitAnimations();
}
checkForRefresh = false;
};
}
示例11: ViewDidLoad
public override void ViewDidLoad()
{
/*TODO Remove sections = new List<string>()
{
"Standard",
"Extended"
};*/
seriesTypes = new List<string>()
{
"Line",
"Points",
"Area",
"FastLine",
"HorizLine",
"Bar",
"HorizBar",
"Pie",
"Shape",
"Arrow", //10
"Bubble",
"Gantt",
"Candle",
"Donut",
"Volume",
"Bar3D",
"Points3D",
"Polar",
"PolarBar",
"Radar", //20
"Clock",
"WindRose",
"Pyramid",
"Surface",
"LinePoint",
"BarJoin",
"ColorGrid",
"Waterfall",
"Histogram",
"Error", //30
"ErrorBar",
"Contour",
"Smith",
"Bezier",
"Calendar",
"HighLow",
"TriSurface",
"Funnel",
"Box",
"HorizBox", //40
"HorizArea",
"Tower",
"PointFigure",
"Gauges",
"Vector3D",
"HorizHistogram",
"Map",
"ImageBar",
"Kagi",
"Renko", //50
"IsoSurface",
"Darvas",
"VolumePipe",
"ImagePoint",
"CircularGauge",
"LinearGauge",
"VerticalLinearGauge",
"NumericGauge",
"OrgSeries",
"TagCloud",
//"WorldMap", CDI worldmap
"PolarGrid",
"Ternary",
"KnobGauge"
};
tableView = new UITableView(new RectangleF(0,0,0,0),UITableViewStyle.Grouped)
{
Delegate = new TableViewDelegate(seriesTypes),
DataSource = new TableViewDataSource(/*seriesTypes*/),
AutoresizingMask =
UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.LightGray,
};
// Set the table view to fit the width of the app.
tableView.SizeToFit();
// Reposition and resize the receiver
tableView.Frame = new RectangleF (
0, 0, this.View.Frame.Width,
this.View.Frame.Height);
// Add the table view as a subview
this.View.AddSubview(tableView);
}
示例12: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
// no XIB !
navBar = new UINavigationBar();
navBar.PushNavigationItem (new UINavigationItem("Choose Location"), false);
navBar.BarStyle = UIBarStyle.Black;
navBar.Frame = new RectangleF(0,0,this.View.Frame.Width,45);
navBar.TopItem.RightBarButtonItem = new UIBarButtonItem("Done",UIBarButtonItemStyle.Bordered, delegate {FlipController.Flip();});
tableView = new UITableView()
{
Delegate = new TableViewDelegate(this, _locations),
DataSource = new TableViewDataSource(this, _locations),
AutoresizingMask = UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
Frame = new RectangleF (0, 45, this.View.Frame.Width, this.View.Frame.Height-44)
, TableHeaderView = navBar,
BackgroundColor = UIColor.Black,
};
//quick hack to make cell text white
foreach (var item in tableView.VisibleCells) {
item.TextLabel.TextColor = UIColor.White;
}
// Set the table view to fit the width of the app.
tableView.SizeToFit();
// Reposition and resize the receiver
tableView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height);
// Add the table view as a subview
this.View.AddSubview(tableView);
}
示例13: ViewDidLoad
// add this string to the extra arguments for mtouch
// -gcc_flags "-framework QuartzCore -L${ProjectDir} -lAdMobSimulator3_0 -ObjC"
public override void ViewDidLoad()
{
base.ViewDidLoad ();
checkForRefresh = false;
reloading = false;
list = new List<string>()
{
"Tangerine",
"Mango",
"Grapefruit",
"Orange",
"Banana"
};
tableView = new UITableView()
{
Delegate = new TableViewDelegate(list),
DataSource = new TableViewDataSource(list),
AutoresizingMask =
UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
//BackgroundColor = UIColor.Yellow,
};
// Set the table view to fit the width of the app.
tableView.SizeToFit();
// Reposition and resize the receiver
tableView.Frame = new RectangleF (
0, 0, this.View.Frame.Width,
this.View.Frame.Height);
RefreshTableHeaderView refreshHeaderView = new RefreshTableHeaderView();
refreshHeaderView.BackgroundColor = new UIColor (226.0f,231.0f,237.0f,1.0f);
tableView.AddSubview (refreshHeaderView);
// Add the table view as a subview
this.View.AddSubview(tableView);
tableView.DraggingStarted += delegate {
checkForRefresh = true;
};
tableView.Scrolled += delegate(object sender, EventArgs e) {
if (checkForRefresh) {
if (refreshHeaderView.isFlipped && (tableView.ContentOffset.Y > - 65.0f) && (tableView.ContentOffset.Y < 0.0f) && !reloading)
{
refreshHeaderView.flipImageAnimated (true);
refreshHeaderView.setStatus (TableViewPullRefresh.RefreshTableHeaderView.RefreshStatus.PullToReloadStatus);
}
else if ((!refreshHeaderView.isFlipped) && (this.tableView.ContentOffset.Y < -65.0f))
{
refreshHeaderView.flipImageAnimated (true);
refreshHeaderView.setStatus(TableViewPullRefresh.RefreshTableHeaderView.RefreshStatus.ReleaseToReloadStatus );
}
}
};
tableView.DraggingEnded += delegate(object sender, EventArgs e) {
if (this.tableView.ContentOffset.Y <= -65.0f){
//ReloadTimer = NSTimer.CreateRepeatingScheduledTimer (new TimeSpan (0, 0, 0, 10, 0), () => dataSourceDidFinishLoadingNewData ());
ReloadTimer = NSTimer.CreateScheduledTimer (new TimeSpan (0, 0, 0, 5, 0),
delegate {
// for this demo I cheated and am just going to pretend data is reloaded
// in real world use this function to really make sure data is reloaded
ReloadTimer = null;
Console.WriteLine ("dataSourceDidFinishLoadingNewData() called from NSTimer");
reloading = false;
refreshHeaderView.flipImageAnimated (false);
refreshHeaderView.toggleActivityView();
UIView.BeginAnimations("DoneReloadingData");
UIView.SetAnimationDuration(0.3);
tableView.ContentInset = new UIEdgeInsets (0.0f,0.0f,0.0f,0.0f);
refreshHeaderView.setStatus(TableViewPullRefresh.RefreshTableHeaderView.RefreshStatus.PullToReloadStatus);
UIView.CommitAnimations();
refreshHeaderView.setCurrentDate();
});
reloading = true;
tableView.ReloadData();
refreshHeaderView.toggleActivityView();
UIView.BeginAnimations("ReloadingData");
UIView.SetAnimationDuration(0.2);
this.tableView.ContentInset = new UIEdgeInsets (60.0f,0.0f,0.0f,0.0f);
UIView.CommitAnimations();
}
checkForRefresh = false;
};
}
示例14: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Perform any additional setup after loading the view, typically from a nib.
iconLocation = Images.IconLocation;
iconYouSee = Images.IconYouSee;
iconInventory = Images.IconInventory;
iconTask = Images.IconTask;
iconPosition = Images.IconPosition;
// Show back button
NavigationItem.SetHidesBackButton (false, false);
// Create source for table view
MainScreenSource mainListSource = new MainScreenSource(this, ctrl);
// Create table view
Table = new UITableView()
{
Source = mainListSource,
AutoresizingMask = UIViewAutoresizing.All,
AutosizesSubviews = true
};
// Set the table view to fit the width of the app.
Table.SizeToFit();
// Reposition and resize the receiver
Table.Frame = new RectangleF (0, 0, this.View.Frame.Width,this.View.Frame.Height);
// Add the table view as a subview
this.View.AddSubviews(this.Table);
}
示例15: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
this.whichJudge.Text = "Head Judge";
this.status.LineBreakMode = UILineBreakMode.WordWrap;
list = new List<string>();
InvokeOnMainThread(delegate{
// txtSktStatus.Text = test.SocketStatusClient.ToString();
});
//---- set any user default values (they're not actually set until
//UserDefaultsHelper.LoadDefaultSettings ();
//---- initialize our user settings, which loads them from the file (if they exist)
//NSUserDefaults.StandardUserDefaults.Init ();
// Perform any additional setup after loading the view, typically from a nib.
CurrentRankings = new UITableView()
{
Delegate = new TableViewDelegate(list),
DataSource = new TableViewDataSource(list),
AutoresizingMask =
UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.Clear,
SeparatorColor = UIColor.Clear,
AllowsSelection = false,
Hidden = false,
};
// Set the table view to fit the width of the app.
CurrentRankings.SizeToFit();
// Reposition and resize the receiver
CurrentRankings.Frame = new RectangleF (
(this.View.Frame.Width/4)*3, 0, (this.View.Frame.Width/4),
this.View.Frame.Height);
// Add the table view as a subview
this.View.AddSubview(CurrentRankings);
// Perform any additional setup after loading the view, typically from a nib.
}