本文整理汇总了C#中UITextView类的典型用法代码示例。如果您正苦于以下问题:C# UITextView类的具体用法?C# UITextView怎么用?C# UITextView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UITextView类属于命名空间,在下文中一共展示了UITextView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
View.BackgroundColor = UIColor.White;
var gameNameLabel = new UILabel(new RectangleF(10, 80, View.Frame.Width - 20, 20));
gameNameLabel.Text = "Spartakiade Quiz";
View.AddSubview(gameNameLabel);
var playname = new UITextView(new RectangleF(10, 110, View.Frame.Width - 20, 20));
playname.BackgroundColor = UIColor.Brown;
View.AddSubview(playname);
var btnStartGame = new UIButton(new RectangleF(10, 140, View.Frame.Width - 20, 20));
btnStartGame.SetTitle("Start game", UIControlState.Normal);
btnStartGame.BackgroundColor = UIColor.Blue;
btnStartGame.TouchUpInside += delegate
{
NavigationController.PushViewController(new PlayGameController(playname.Text), true);
};
View.AddSubview(btnStartGame);
}
示例2: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "Text View";
textView = new UITextView (View.Frame){
TextColor = UIColor.Black,
Font = UIFont.FromName ("Arial", 18f),
BackgroundColor = UIColor.White,
Text = "This code brought to you by ECMA 334, ECMA 335 and the Mono Team at Novell\n\n\nEmbrace the CIL!",
ReturnKeyType = UIReturnKeyType.Default,
KeyboardType = UIKeyboardType.Default,
ScrollEnabled = true,
AutoresizingMask = UIViewAutoresizing.FlexibleHeight,
};
// Provide our own save button to dismiss the keyboard
textView.Started += delegate {
var saveItem = new UIBarButtonItem (UIBarButtonSystemItem.Done, delegate {
textView.ResignFirstResponder ();
NavigationItem.RightBarButtonItem = null;
});
NavigationItem.RightBarButtonItem = saveItem;
};
View.AddSubview (textView);
}
示例3: Binding_Test1_Error
public void Binding_Test1_Error()
{
Vm = new AccountViewModel();
#if ANDROID
Operation = new EditText(Application.Context);
ChildName = new EditText(Application.Context);
#elif __IOS__
Operation = new UITextView();
ChildName = new UITextView();
#endif
_binding1 = this.SetBinding(
() => Vm.FormattedOperation,
() => Operation.Text);
_binding2 = this.SetBinding(
() => Vm.AccountDetails.Name,
() => ChildName.Text,
fallbackValue: "Fallback",
targetNullValue: "TargetNull");
Assert.AreEqual(AccountViewModel.EmptyText, Operation.Text);
Assert.AreEqual(_binding2.FallbackValue, ChildName.Text);
Vm.SetAccount();
Assert.AreEqual(
AccountViewModel.NotEmptyText + Vm.AccountDetails.Balance + Vm.Amount,
Operation.Text);
Assert.AreEqual(Vm.AccountDetails.Name, ChildName.Text);
}
示例4: Selected
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
{
if (IsReadonly) {
base.Selected (dvc, tableView, path);
return;
}
var controller = new UIViewController ();
UITextView disclaimerView = new UITextView (controller.View.Frame);
// disclaimerView.BackgroundColor = UIColor.FromWhiteAlpha (0, 0);
// disclaimerView.TextColor = UIColor.White;
// disclaimerView.TextAlignment = UITextAlignment.Left;
if (!string.IsNullOrWhiteSpace (Value))
disclaimerView.Text = Value;
else
disclaimerView.Text = string.Empty;
disclaimerView.Font = UIFont.SystemFontOfSize (16f);
disclaimerView.Editable = true;
controller.View.AddSubview (disclaimerView);
controller.NavigationItem.Title = Caption;
controller.NavigationItem.RightBarButtonItem = new UIBarButtonItem (string.IsNullOrEmpty (_saveLabel) ? "Save" : _saveLabel, UIBarButtonItemStyle.Done, (object sender, EventArgs e) => {
if (OnSave != null)
OnSave (this, EventArgs.Empty);
controller.NavigationController.PopViewControllerAnimated (true);
Value = disclaimerView.Text;
});
dvc.ActivateController (controller);
}
示例5: UiSetKeyboardEditorWithCloseButton
public static void UiSetKeyboardEditorWithCloseButton(this UITextField txt, UIKeyboardType keyboardType)
{
var toolbar = new UIToolbar
{
BarStyle = UIBarStyle.Black,
Translucent = true,
};
txt.KeyboardType = keyboardType;
toolbar.SizeToFit();
var text = new UITextView(new CGRect(0, 0, 200, 32))
{
ContentInset = UIEdgeInsets.Zero,
KeyboardType = keyboardType,
Text = txt.Text,
UserInteractionEnabled = true
};
text.Layer.CornerRadius = 4f;
text.BecomeFirstResponder();
var doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
(s, e) =>
{
text.ResignFirstResponder();
txt.ResignFirstResponder();
});
toolbar.UserInteractionEnabled = true;
toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true);
txt.InputAccessoryView = toolbar;
}
示例6: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
_loadDataButton = UIButton.FromType(UIButtonType.RoundedRect);
_loadDataButton.SetTitle("Hent sanntidsdata", UIControlState.Normal);
_loadDataButton.Frame = new RectangleF(10, 10, View.Bounds.Width - 20, 50);
_result = new UITextView(new RectangleF(10, 70, View.Bounds.Width - 20, View.Bounds.Height - 80));
_result.Font = UIFont.FromName("Arial", 14);
_result.Editable = false;
_activityIndicator = new UIActivityIndicatorView(new RectangleF(View.Bounds.Width / 2 - 20, View.Bounds.Height / 2 - 20, 40, 40));
_activityIndicator.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
_activityIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;
View.AddSubview(_activityIndicator);
View.AddSubview(_loadDataButton);
View.AddSubview(_result);
View.BackgroundColor = UIColor.DarkGray;
_loadDataButton.TouchUpInside += delegate(object sender, EventArgs e) {
if(_location != null)
{
_activityIndicator.StartAnimating();
_result.Text = "Jobber..." + Environment.NewLine + Environment.NewLine;
var coordinate = new GeographicCoordinate(_location.Latitude, _location.Longtitude);
ThreadPool.QueueUserWorkItem(o => _sanntid.GetNearbyStops(coordinate, BusStopsLoaded));
}
};
_gpsService.LocationChanged = location => _location = location;
_gpsService.Start();
}
示例7: NewMessageController
public NewMessageController ()
{
Title = "New Post";
NavigationItem.LeftBarButtonItem = new UIBarButtonItem (
UIBarButtonSystemItem.Cancel,
delegate {
DismissModalViewControllerAnimated (true);
});
NavigationItem.RightBarButtonItem = new UIBarButtonItem (
UIBarButtonSystemItem.Save,
delegate {
DismissModalViewControllerAnimated (true);
Saved (new Message {
Id = Guid.NewGuid (),
From = UIDevice.CurrentDevice.Name,
Text = _text.Text,
Time = DateTime.UtcNow,
});
});
var b = View.Bounds;
_text = new UITextView (new RectangleF (0, 0, b.Width, 200)) {
Font = UIFont.SystemFontOfSize (20),
};
_text.BecomeFirstResponder ();
View.AddSubview (_text);
}
示例8: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
View.BackgroundColor = UIColor.White;
float statusBarHeight = float.Parse(UIDevice.CurrentDevice.SystemVersion) >= 7 ?
UIApplication.SharedApplication.StatusBarFrame.Height : 0f;
button = new BlueButton (new RectangleF (10, 10 + statusBarHeight, 120, 120 - statusBarHeight));
button.Tapped += (obj) => {
new UIAlertView ("Tapped", "Button tapped", null, "OK", null).Show ();
};
View.AddSubview (button);
text = new UITextView (new RectangleF (10, 100 + statusBarHeight, 300, 300 - statusBarHeight));
text.Font = UIFont.SystemFontOfSize (14f);
text.Editable = false;
text.Text = "PaintCode BlueButton Example\n\n"
+ "After the button is drawn in PaintCode then added to a UIButton subclass "
+ "Draw() method override, some color/style properties are tweaked in code "
+ "to create the TouchDown effect.";
View.AddSubview (text);
}
示例9: 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 view = new UIView (UIScreen.MainScreen.Bounds);
view.BackgroundColor = UIColor.White;
controller.View = view;
controller.NavigationItem.Title = "SignalR Client";
var textView = new UITextView(new RectangleF(0, 0, 320, view.Frame.Height - 0));
view.AddSubview (textView);
navController = new UINavigationController (controller);
window.RootViewController = navController;
window.MakeKeyAndVisible();
var traceWriter = new TextViewWriter(SynchronizationContext.Current, textView);
var client = new CommonClient(traceWriter);
client.RunAsync("http://signalr-test1.cloudapp.net:82/");
return true;
}
示例10: SetupUserInterface
private void SetupUserInterface ()
{
scrollView = new UIScrollView {
BackgroundColor = UIColor.Clear.FromHexString ("#336699", 1.0f),
Frame = new CGRect (0, 0, Frame.Width, Frame.Height)
};
licensureLabel = new UILabel {
Font = UIFont.FromName ("SegoeUI-Light", 30f),
Frame = new CGRect (0, 20, Frame.Width, 35),
Text = "Terms of Service",
TextAlignment = UITextAlignment.Center,
TextColor = UIColor.White
};
textView = new UITextView {
BackgroundColor = UIColor.Clear,
Font = UIFont.FromName ("SegoeUI-Light", 15f),
Frame = new CGRect (20, 50, Frame.Width - 40, Frame.Height * 1.75),
Text = "Willie’s Cycle will assume no damage liability from the sales of used or new parts. This damage includes personal injury, property, vehicle, monetary, punitive, emotional, and mental damage. All risk and liability is assumed by the purchaser or the installer of any product sold by Willie’s Cycle. Willie’s Cycle cannot be held liable for any of the following reasons: damage to person or property, including damage or injury to driver, passenger, or any other person, animal or property damage that may occur have occurred after purchasing any product from Willie’s Cycle. Willie’s Cycle will only accept returns for parts to be used in store credit or, at our discretion. Willie’s Cycle will give refunds due to applications not being as described. Willie’s Cycle will only give credit or refund up to full purchase amount of the product. Willie’s Cycle may charge a restock fee for returned parts. This restock fee is a minimum of 20% of the purchase price. All parts are expected to have normal wear, and in no way do we consider used parts to be in any condition other than used functional parts with wear, unless otherwise noted. Any returns must be sent with return authorization. RA# may be granted by providing the following: Date of purchase, transaction number, year, model, make, and VIN number of vehicle. Returns can be rejected if purchase was made on account of buyer error. Amount of refund or credit is determined solely by Willie’s Cycle. Returned item must be received by Willie’s Cycle within 30 days of original purchase date. All returned items must be returned in the same condition as they were received.",
TextColor = UIColor.White,
UserInteractionEnabled = false
};
scrollView.ContentSize = new CGSize (Frame.Width, Frame.Height * 1.75);
scrollView.Add (licensureLabel);
scrollView.Add (textView);
Add (scrollView);
}
示例11: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
// 建立所需的控制項
_btnCreateDatabase = UIButton.FromType(UIButtonType.RoundedRect);
_btnCreateDatabase.Frame = new RectangleF(10, 10, 80, 50);
_btnCreateDatabase.SetTitle("建立数据库", UIControlState.Normal);
_btnCreateCipherDB = UIButton.FromType(UIButtonType.RoundedRect);
_btnCreateCipherDB.Frame = new RectangleF(100, 10, 115, 50);
_btnCreateCipherDB.SetTitle("建立加密数据库", UIControlState.Normal);
_btnRead = UIButton.FromType(UIButtonType.RoundedRect);
_btnRead.Frame = new RectangleF(225, 10, 80, 50);
_btnRead.SetTitle("读取", UIControlState.Normal);
_txtView = new UITextView(new RectangleF(10, 90, 300, 350));
_txtView.Editable = false;
_txtView.ScrollEnabled = true;
_btnCreateDatabase.TouchUpInside += HandleTouchUpInside;
_btnCreateCipherDB.TouchUpInside += _btnCreateCipherDB_TouchUpInside;
_btnRead.TouchUpInside += _btnRead_TouchUpInside;
Add(_btnCreateDatabase);
Add(_btnCreateCipherDB);
Add(_btnRead);
Add(_txtView);
}
示例12: 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);
});
}
示例13: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
Title = "Export";
View.BackgroundColor = UIColor.GroupTableViewBackgroundColor;
// Export textbox
_textFieldExport = new UITextView();
_textFieldExport.Frame = new RectangleF(10, 15, 300, 200);
View.AddSubview(_textFieldExport);
// Help label
_labelHelp = new UILabel();
_labelHelp.Text = "The questions are exported in comma separated format (CSV), e.g.:" +
"\n\n" +
"category name,question,answer\n\n" +
"A tilde is used (~) as a replacement for any comma. Use the standard iPhone/iTouch clipboard copy " +
"feature to save the list.";
_labelHelp.Font = UIFont.SystemFontOfSize(14f);
_labelHelp.TextColor = UIColor.DarkGray;
_labelHelp.Frame = new RectangleF(15, 235, 295, 150);
_labelHelp.BackgroundColor = UIColor.Clear;
_labelHelp.Lines = 10;
View.AddSubview(_labelHelp);
// Hide the toolbar.
NavigationController.SetToolbarHidden(true, true);
NavigationItem.HidesBackButton = false;
}
示例14: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Figure out where the SQLite database will be.
var documents = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
_pathToDatabase = Path.Combine(documents, "db_sqlite-net.db");
// Create the buttons and TextView to run the sample code
_btnCreateDatabase = UIButton.FromType(UIButtonType.RoundedRect);
_btnCreateDatabase.Frame = new CGRect(10, 10, 145, 50);
_btnCreateDatabase.SetTitle("Create Database", UIControlState.Normal);
_btnInsertUser = UIButton.FromType(UIButtonType.RoundedRect);
_btnInsertUser.Frame = new CGRect(165, 10, 145, 50);
_btnInsertUser.SetTitle("Insert User", UIControlState.Normal);
_btnInsertUser.Enabled = false; // Disable the button. It will be enabled when the database is created.
_txtView = new UITextView(new CGRect(10, 90, 300, 350));
_txtView.Editable = false;
_txtView.ScrollEnabled = true;
_btnCreateDatabase.TouchUpInside += HandleTouchUpInsideForCreateDatabase;
Add(_btnCreateDatabase);
Add(_btnInsertUser);
Add(_txtView);
}
示例15: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
_statusTextView = new UITextView ();
_emailTextView = new UITextView ();
_createTopicButton = UIButton.FromType (UIButtonType.RoundedRect);
_subscribeButton = UIButton.FromType (UIButtonType.RoundedRect);
_deleteTopicButton = UIButton.FromType (UIButtonType.RoundedRect);
_createTopicButton.SetTitle ("Create Topic", UIControlState.Normal);
_subscribeButton.SetTitle ("Subscribe", UIControlState.Normal);
_deleteTopicButton.SetTitle ("Delete Topic", UIControlState.Normal);
_createTopicButton.TouchUpInside += createTopic_Click;
_subscribeButton.TouchUpInside += subscribe_Click;
_deleteTopicButton.TouchUpInside += deleteTopic_Click;
_emailTextView.Delegate = new EmailTextViewDelegate ();
_statusTextView.Frame = new RectangleF (0, 256, 256, 64);
_emailTextView.Frame = new RectangleF (0, 0, 256, 64);
_createTopicButton.Frame = new RectangleF (0, 64, 256, 64);
_subscribeButton.Frame = new RectangleF (0, 128, 256, 64);
_deleteTopicButton.Frame = new RectangleF (0, 192, 256, 64);
this.View.AddSubview (_emailTextView);
this.View.AddSubview (_createTopicButton);
this.View.AddSubview (_subscribeButton);
this.View.AddSubview (_deleteTopicButton);
this.View.AddSubview (_statusTextView);
}