本文整理汇总了C#中UIViewController.Add方法的典型用法代码示例。如果您正苦于以下问题:C# UIViewController.Add方法的具体用法?C# UIViewController.Add怎么用?C# UIViewController.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIViewController
的用法示例。
在下文中一共展示了UIViewController.Add方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderStream
public void RenderStream (Stream stream)
{
var reader = new StreamReader (stream);
InvokeOnMainThread (delegate {
button1.Enabled = true;
var view = new UIViewController ();
var handler = new UILabel (new CGRect (20, 20, 300, 40)) {
Text = "HttpClient is using " + HandlerType?.Name
};
var label = new UILabel (new CGRect (20, 20, 300, 80)) {
Text = "The HTML returned by the server:"
};
var tv = new UITextView (new CGRect (20, 100, 300, 400)) {
Text = reader.ReadToEnd ()
};
if (HandlerType != null)
view.Add (handler);
view.Add (label);
view.Add (tv);
if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
view.EdgesForExtendedLayout = UIRectEdge.None;
}
navigationController.PushViewController (view, true);
});
}
示例2: RenderStream
public void RenderStream(System.IO.Stream stream)
{
var reader = new System.IO.StreamReader(stream);
ad.InvokeOnMainThread(delegate
{
var view = new UIViewController();
var label = new UILabel(new RectangleF(20, 20, 300, 80))
{
Text = "The HTML returned by the server:"
};
var tv = new UITextView(new RectangleF(20, 100, 300, 400))
{
Text = reader.ReadToEnd()
};
view.Add(label);
view.Add(tv);
Console.WriteLine(tv.Text);
if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
{
view.EdgesForExtendedLayout = UIRectEdge.None;
}
ad.NavigationController.PushViewController(view, true);
});
}
示例3: FinishedLaunching
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
root = new UIViewController ();
vc1 = new ViewController1 ();
root.View.AddSubview (vc1.View);
vc1.InitialActionCompleted += (object sender, EventArgs e) => {
vc1.View.RemoveFromSuperview ();
tabController = new UITabBarController ();
vc2 = new ViewController2 ();
vc3 = new ViewController3 ();
tabController.ViewControllers = new UIViewController[] {
vc1,
vc2,
vc3
};
tabController.ViewControllers [0].TabBarItem.Title = "One";
tabController.ViewControllers [1].TabBarItem.Title = "Two";
tabController.ViewControllers [2].TabBarItem.Title = "Three";
root.AddChildViewController (tabController);
root.Add (tabController.View);
};
window.RootViewController = root;
window.MakeKeyAndVisible ();
return true;
}
示例4: OnElementChanged
protected override void OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<Xamarin.Forms.Button> e)
{
base.OnElementChanged (e);
if (e.NewElement != null) {
Control.TouchUpInside += delegate(object sender, EventArgs e2) {
var formsView = new CommonFormsView ();
var rect = new CGRect (0, 0, 400, 400);
var iOSView = FormsViewToNativeiOS.ConvertFormsToNative (formsView, rect);
var viewController = new UIViewController();
viewController.Add(iOSView);
viewController.View.Frame = rect;
var popoverController = new UIPopoverController(viewController);
popoverController.ContentViewController.View.BackgroundColor = viewController.View.BackgroundColor;
popoverController.PopoverContentSize = rect.Size;
var frame = UIApplication.SharedApplication.KeyWindow.RootViewController.View.Frame;
popoverController.PresentFromRect (Control.Frame, UIApplication.SharedApplication.KeyWindow.RootViewController.View, 0, true);
};
}
}
示例5: FinishedLaunching
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
window = new UIWindow(UIScreen.MainScreen.Bounds);
var controller = new UIViewController();
var label = new UILabel(new RectangleF(0, 0, 320, 30));
label.Text = "SignalR Client";
var textView = new UITextView(new RectangleF(0, 35, 320, 500));
controller.Add(label);
controller.Add(textView);
window.RootViewController = controller;
window.MakeKeyAndVisible();
var traceWriter = new TextViewWriter(SynchronizationContext.Current, textView);
var client = new CommonClient(traceWriter);
client.RunAsync();
return true;
}
示例6: FinishedLaunching
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
// Initialize the Parse client with your Application ID and Windows Key found on
// your Parse dashboard
// PARSE INTERNAL
// To properly scrub this project for public release, the following changes must be made:
// 1. This region should be replaced with a template Parse.Initialize call.
// 2. The project must stop requesting intranet permission.
// 3. The project may not access Parse.snk, or it will retain access to Parse internals.
// 4. We must verify that Parse.snk is never copied to this project directory by msbuild.
//ParseClient.HostName = new Uri("http://parse-local:3000/")
ParseClient.Initialize("ZIqbEBf3PXXSzpbQbvz5BcmVcK54DjSmKwNxCah1", "EY4UfiJn0xGhvgvNhBRrY6kggn4nv9zGGk5klQQo");
// END PARSE INTERNAL
// Register for remote notifications
if (Convert.ToInt16(UIDevice.CurrentDevice.SystemVersion.Split('.')[0].ToString()) < 8) {
UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
} else {
UIUserNotificationType notificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
var settings = UIUserNotificationSettings.GetSettingsForTypes(notificationTypes, new NSSet(new string[] { }));
UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
UIApplication.SharedApplication.RegisterForRemoteNotifications();
}
// Handle Parse Push notification.
ParsePush.ParsePushNotificationReceived += (object sender, ParsePushNotificationEventArgs args) => {
Console.WriteLine("You received a notification!");
};
// create a new window instance based on the screen size
window = new UIWindow(UIScreen.MainScreen.Bounds);
UIViewController viewController = new UIViewController();
UILabel label = new UILabel(new CoreGraphics.CGRect(0, 0, 160, 20));
label.Text = "Parse Push is ready!";
label.TextColor = UIColor.Gray;
label.Center = viewController.View.Center;
viewController.Add(label);
window.BackgroundColor = UIColor.White;
// If you have defined a view, add it here:
window.RootViewController = viewController;
window.MakeKeyAndVisible();
return true;
}
示例7: FinishedLaunching
public override bool FinishedLaunching(UIApplication application, NSDictionary options)
{
window = new UIWindow();
navcontroller = new UINavigationController();
viewcontroller = new UIViewController();
viewcontroller.Title = "XibLess";
view = new UIView(new RectangleF(0, 0, 320, 640));
view.BackgroundColor = UIColor.Blue;
viewcontroller.Add(view);
navcontroller.PushViewController(viewcontroller, false);
window.AddSubview (navcontroller.View);
window.MakeKeyAndVisible ();
return true;
}
示例8: FinishedLaunching
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options) {
// Initialize the Parse client with your Application ID and Windows Key found on
// your Parse dashboard
ParseClient.Initialize("YOUR APPLICATION ID", "YOUR .NET KEY");
// Register for remote notifications
if (Convert.ToInt16(UIDevice.CurrentDevice.SystemVersion.Split('.')[0].ToString()) < 8) {
UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
} else {
UIUserNotificationType notificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
var settings = UIUserNotificationSettings.GetSettingsForTypes(notificationTypes, new NSSet(new string[] { }));
UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
UIApplication.SharedApplication.RegisterForRemoteNotifications();
}
// Handle Parse Push notification.
ParsePush.ParsePushNotificationReceived += (object sender, ParsePushNotificationEventArgs args) => {
Console.WriteLine("You received a notification!");
};
// create a new window instance based on the screen size
window = new UIWindow(UIScreen.MainScreen.Bounds);
UIViewController viewController = new UIViewController();
UILabel label = new UILabel(new CoreGraphics.CGRect(0, 0, 160, 20));
label.Text = "Parse Push is ready!";
label.TextColor = UIColor.Gray;
label.Center = viewController.View.Center;
viewController.Add(label);
window.BackgroundColor = UIColor.White;
// If you have defined a view, add it here:
window.RootViewController = viewController;
window.MakeKeyAndVisible();
return true;
}
示例9: RenderStream
public void RenderStream (Stream stream)
{
var reader = new System.IO.StreamReader (stream);
InvokeOnMainThread (delegate {
var view = new UIViewController ();
view.View.BackgroundColor = UIColor.White;
var label = new UILabel (new CGRect (20, 60, 300, 80)){
Text = "The HTML returned by the server:"
};
var tv = new UITextView (new CGRect (20, 140, 300, 400)){
Text = reader.ReadToEnd ()
};
view.Add (label);
view.Add (tv);
navigationController.PushViewController (view, true);
});
}
示例10: RenderStream
public void RenderStream (Stream stream)
{
var reader = new System.IO.StreamReader (stream);
InvokeOnMainThread (delegate {
var view = new UIViewController ();
var label = new UILabel (new RectangleF (20, 20, 300, 80)){
Text = "The HTML returned by Google:"
};
var tv = new UITextView (new RectangleF (20, 100, 300, 400)){
Text = reader.ReadToEnd ()
};
view.Add (label);
view.Add (tv);
navigationController.PushViewController (view, true);
});
}
示例11: ShowPicture
private void ShowPicture()
{
var data = presenter.Model.Image;
if (data == null)
{
new UIAlertView("Error","No saved imaged for this item",null,"OK",null).Show();
return;
}
NSData imageData = NSData.FromArray(data);
var image = UIImage.LoadFromData(imageData);
var imageView = new UIImageView(View.Bounds);
imageView.Image = image;
var vc = new UIViewController();
vc.Add(imageView);
NavigationController.PushViewController(vc,true);
}
示例12: FinishedLaunching
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
NSTimer.CreateScheduledTimer (0.1, (v) => TickOnce ());
dvc = new UIViewController ();
dvc.View.BackgroundColor = UIColor.White;
button = new UIButton (window.Bounds);
button.TouchDown += (object sender, EventArgs e) =>
{
Tapped ();
};
button.SetTitleColor (UIColor.Blue, UIControlState.Normal);
button.SetTitleColor (UIColor.Gray, UIControlState.Highlighted);
button.SetTitle ("Click here", UIControlState.Normal);
dvc.Add (button);
window.RootViewController = dvc;
window.MakeKeyAndVisible ();
return true;
}