本文整理汇总了C#中UITableView.AddSubview方法的典型用法代码示例。如果您正苦于以下问题:C# UITableView.AddSubview方法的具体用法?C# UITableView.AddSubview怎么用?C# UITableView.AddSubview使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITableView
的用法示例。
在下文中一共展示了UITableView.AddSubview方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
tableView = new UITableView {
TranslatesAutoresizingMaskIntoConstraints = false,
AllowsSelection = true,
SeparatorStyle = UITableViewCellSeparatorStyle.None,
};
tableView.BackgroundColor = new UIColor (1f,1f,1f,0.7f);
View.AddSubview (tableView);
RefreshControl = new UIRefreshControl ();
RefreshControl.ValueChanged += async (sender, args) =>
{
await LoadChurches ();
RefreshControl.EndRefreshing(); // Signal controller that we are done.
};
tableView.AddSubview (RefreshControl);
searchBarView = new UIView (new CGRect(0,64,320,30));
searchBar = new UISearchBar (new CGRect(0,0,320,30));
searchBar.Placeholder = "Enter a Church Name, City, or Zip Code";
searchBar.TextChanged += (sender, e) => {
//filter main list
_subChurches = prayerService.GlobalChurches
.Where(c=>c.Name.Contains(e.SearchText)
|| c.City.Contains(e.SearchText)
|| c.Zip.Contains(e.SearchText)
).ToList();
if (e.SearchText == default(string)) {
_subChurches = prayerService.GlobalChurches;
}
if (_subChurches.Count > 0){
tableView.Source = new ChurchSource(_subChurches,this,prayerService);
tableView.ReloadData();
}
};
View.AddSubview (searchBarView);
searchBarView.AddSubview (searchBar);
}
示例2: ViewDidLoad
public override void ViewDidLoad()
{
this.Title = "Nær deg";
_mapButton = new UIBarButtonItem("Kart", UIBarButtonItemStyle.Bordered, delegate {
NavigationController.PushViewController(new MapViewController("Nær deg", _nearbyBusStops.ToArray()), true);
});
NavigationItem.RightBarButtonItem = _mapButton;
_tableView = new UITableView(View.Bounds, UITableViewStyle.Plain);
View.AddSubview(_tableView);
_refreshHeaderView = new RefreshTableHeaderView ();
_tableView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
_tableView.AddSubview (_refreshHeaderView);
}
示例3: 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;
};
}
示例4: initInterface
private void initInterface()
{
_tvTorrents = new UITableView {
Frame = new RectangleF (0, 0, UIScreen.MainScreen.Bounds.Width,
UIScreen.MainScreen.Bounds.Height - 50)
};
_rcRefreshControl = new UIRefreshControl();
_rcRefreshControl.ValueChanged += (sender, e) => {
refreshTorrents();
displayTorrents();
};
_tvTorrents.AddSubview (_rcRefreshControl);
View.AddSubviews (new UIView[] { _tvTorrents });
LoadTorrents ();
displayTorrents ();
}
示例5: initInterface
private void initInterface()
{
_progressHud = new MTMBProgressHUD (this.View);
_txtServerHost = new UITextField {
Frame = new RectangleF (20, 23, 280, 25)
};
_txtServerHost.Placeholder = "Server hostname";
_txtServerHost.BorderStyle = UITextBorderStyle.RoundedRect;
_txtServerHost.KeyboardType = UIKeyboardType.Url;
_txtServerHost.AutocapitalizationType = UITextAutocapitalizationType.None;
_txtServerHost.AutocorrectionType = UITextAutocorrectionType.No;
_txtServerHost.ShouldReturn += (textField) => {
textField.ResignFirstResponder();
return true;
};
_txtServerPort = new UITextField {
Frame = new RectangleF (20, 49, 65, 25)
};
_txtServerPort.Placeholder = "Port";
_txtServerPort.BorderStyle = UITextBorderStyle.RoundedRect;
_txtServerPort.KeyboardType = UIKeyboardType.NumberPad;
_txtServerPort.AutocapitalizationType = UITextAutocapitalizationType.None;
_txtServerPort.AutocorrectionType = UITextAutocorrectionType.No;
_txtServerPort.ShouldReturn += (textField) => {
textField.ResignFirstResponder();
return true;
};
#if PLUS_VERSION
_txtServerPassword = new UITextField {
Frame = new RectangleF (85, 49, 215, 25)
};
_txtServerPassword.Placeholder = "Password (optional)";
_txtServerPassword.BorderStyle = UITextBorderStyle.RoundedRect;
_txtServerPassword.KeyboardType = UIKeyboardType.Default;
_txtServerPassword.AutocapitalizationType = UITextAutocapitalizationType.None;
_txtServerPassword.AutocorrectionType = UITextAutocorrectionType.No;
_txtServerPassword.SecureTextEntry = true;
_txtServerPassword.ShouldReturn += (textField) => {
textField.ResignFirstResponder();
return true;
};
#endif
UILabel lblAutoConnect = new UILabel {
Frame = new RectangleF (5, 82, 200, 17)
};
lblAutoConnect.TextAlignment = UITextAlignment.Right;
lblAutoConnect.Text = "Auto-connect at startup";
_swAutoConnect = new UISwitch {
Frame = new RectangleF (250, 75, 49, 31)
};
_tvServers = new UITableView {
Frame = new RectangleF (0, 111, UIScreen.MainScreen.Bounds.Width,
UIScreen.MainScreen.Bounds.Height - 160)
};
_rcRefreshControl = new UIRefreshControl();
_rcRefreshControl.ValueChanged += (sender, e) => { doRefreshServers(); };
_tvServers.AddSubview (_rcRefreshControl);
#if PLUS_VERSION
View.AddSubviews (new UIView[] { _txtServerHost, _txtServerPort, _txtServerPassword,
lblAutoConnect, _swAutoConnect,
_tvServers,
_progressHud
});
#else
View.AddSubviews (new UIView[] { _txtServerHost, _txtServerPort,
lblAutoConnect, _swAutoConnect,
_tvServers
});
#endif
txtSH = _txtServerHost;
txtSP = _txtServerPort;
#if PLUS_VERSION
txtPW = _txtServerPassword;
#endif
}
示例6: 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;
};
}