本文整理汇总了C#中UILabel类的典型用法代码示例。如果您正苦于以下问题:C# UILabel类的具体用法?C# UILabel怎么用?C# UILabel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UILabel类属于命名空间,在下文中一共展示了UILabel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
private void Initialize()
{
BackgroundColor = GlobalTheme.BackgroundColor;
_lblFrequency = new UILabel(new RectangleF(12, 4, 60, 36));
_lblFrequency.BackgroundColor = UIColor.Clear;
_lblFrequency.TextColor = UIColor.White;
_lblFrequency.Font = UIFont.FromName("HelveticaNeue-Light", 12.0f);
_lblValue = new UILabel(new RectangleF(UIScreen.MainScreen.Bounds.Width - 60 - 14, 4, 60, 36));
_lblValue.BackgroundColor = UIColor.Clear;
_lblValue.Text = "0.0 dB";
_lblValue.TextColor = UIColor.White;
_lblValue.TextAlignment = UITextAlignment.Right;
_lblValue.Font = UIFont.FromName("HelveticaNeue-Light", 12.0f);
_slider = new SessionsSlider(new RectangleF(62, 4, UIScreen.MainScreen.Bounds.Width - 120 - 14, 36));
_slider.MinValue = -6;
_slider.MaxValue = 6;
_slider.Value = 0;
_slider.SetThumbImage(UIImage.FromBundle("Images/Sliders/thumb"), UIControlState.Normal);
_slider.SetMinTrackImage(UIImage.FromBundle("Images/Sliders/slider2").CreateResizableImage(new UIEdgeInsets(0, 8, 0, 8), UIImageResizingMode.Tile), UIControlState.Normal);
_slider.SetMaxTrackImage(UIImage.FromBundle("Images/Sliders/slider").CreateResizableImage(new UIEdgeInsets(0, 8, 0, 8), UIImageResizingMode.Tile), UIControlState.Normal);
_slider.ValueChanged += HandleSliderValueChanged;
AddSubview(_lblFrequency);
AddSubview(_lblValue);
AddSubview(_slider);
}
示例2: ViewDidLoad
public override void ViewDidLoad()
{
View = new UIView(){ BackgroundColor = UIColor.White};
base.ViewDidLoad();
var label = new UILabel(new RectangleF(10, 10, 300, 40));
Add(label);
var textField = new UITextField(new RectangleF(10, 50, 300, 40));
Add(textField);
var button = new UIButton(UIButtonType.RoundedRect);
button.SetTitle("Click Me", UIControlState.Normal);
button.Frame = new RectangleF(10, 90, 300, 40);
Add(button);
var button2 = new UIButton(UIButtonType.RoundedRect);
button2.SetTitle("Go Second", UIControlState.Normal);
button2.Frame = new RectangleF(10, 130, 300, 40);
Add(button2);
var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
set.Bind(label).To(vm => vm.Hello);
set.Bind(textField).To(vm => vm.Hello);
set.Bind(button).To(vm => vm.MyCommand);
set.Bind(button2).To(vm => vm.GoSecondCommand);
set.Apply();
}
示例3: GetCell
public override UITableViewCell GetCell(UITableView tv)
{
RectangleF frame;
if (datePicker == null)
{
label = new UILabel
{
Text = Caption
};
label.SizeToFit();
frame = label.Frame;
frame.X = 15;
frame.Y = 5;
label.Frame = frame;
datePicker = CreatePicker();
}
if(datePicker.Date != DateValue)
datePicker.Date = DateValue;
frame = datePicker.Frame;
frame.Y = frame.X = 0;
datePicker.Frame = frame;
var cell = tv.DequeueReusableCell("datePicker") ?? new UITableViewCell(UITableViewCellStyle.Default, "datePicker") { Accessory = UITableViewCellAccessory.None };
cell.ContentView.Add(label);
if(cell.ContentView != datePicker.Superview)
cell.ContentView.Add(datePicker);
return cell;
}
示例4: LoadView
public void LoadView()
{
mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground);
mBackgroundTextureLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.CloudRecognition);
string [] extendedTrackingStyle = {UIConstants.ExtendedTrackingStyleOff, UIConstants.ExtendedTrackingStyleOn};
mExtendedTracking = new UICheckButton(UIConstants.RectOptionOne, false, extendedTrackingStyle);
string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle };
mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles);
string[] cameraFlashStyles = {UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn};
mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionThree, false, cameraFlashStyles);
string[] autofocusStyles = {UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn};
mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionTwo, false, autofocusStyles);
mCameraLabel = new UILabel(UIConstants.RectLabelTwo, UIConstants.CameraLabelStyle);
string[,] cameraFacingStyles = new string[2,2] {{UIConstants.CameraFacingFrontStyleOff, UIConstants.CameraFacingFrontStyleOn},{ UIConstants.CameraFacingRearStyleOff, UIConstants.CameraFacingRearStyleOn}};
UIRect[] cameraRect = { UIConstants.RectOptionFour, UIConstants.RectOptionFive };
mCameraFacing = new UIRadioButton(cameraRect, 1, cameraFacingStyles);
string[] closeButtonStyles = {UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn };
mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles);
}
示例5: LoadingIndicator
private LoadingIndicator() : base()
{
int ScreenWidth = Platform.ScreenWidth;
int ScreenHeight = Platform.ScreenHeight - 80;
const int Padding = 10;
const int TextWidth = 65;
const int SpinnerSize = 20;
const int SeparateWidth = 5;
const int Width = Padding + SpinnerSize + SeparateWidth + TextWidth + Padding;
const int Height = Padding + SpinnerSize + Padding;
Frame = new RectangleF((ScreenWidth - Width) / 2, ScreenHeight / 2, Width, Height);
BackgroundColor = UIColor.FromWhiteAlpha(0.5f, 0.5f);
spinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge)
{
Frame = new RectangleF(Padding, Padding, SpinnerSize, SpinnerSize)
};
label = new UILabel
{
Frame = new RectangleF(Padding + SpinnerSize + SeparateWidth, Padding, TextWidth, SpinnerSize),
Text = "Loading...",
TextColor = StyleExtensions.lightGrayText,
BackgroundColor = StyleExtensions.transparent,
AdjustsFontSizeToFitWidth = true
};
AddSubview(label);
AddSubview(spinner);
Hidden = true;
}
示例6: Start
void Start () {
root = GameObject.Find("UI Root");
gm = GameObject.Find("GameManager").GetComponent<GameManager>();
nameLabel = root.transform.Find("Avg_Panel/Label_Name").GetComponent<UILabel>();
dialogLabel = root.transform.Find("Avg_Panel/Label_Dialog").GetComponent<UILabel>();
nameLabel.fontSize = 22;
}
示例7: Start
// Use this for initialization
void Start ()
{
uiSprite = thumbImgaeObject.GetComponent<UI2DSprite>();
uiLabelName = placeNameObject.GetComponent<UILabel>();
uiLabelInfo = placeInfoObject.GetComponent<UILabel>();
spr = Resources.LoadAll<Sprite>("Background");
}
示例8: ViewForItem
public override UIView ViewForItem(CarouselView carousel, uint index, UIView reusingView)
{
UILabel label;
if (reusingView == null)
{
var imgView = new UIImageView(new RectangleF(0, 0, 200, 200))
{
Image = FromUrl( index > 1 ? product[0].ImageForSize(250) : product[(int)index].ImageForSize(250) ),
ContentMode = UIViewContentMode.Center
};
label = new UILabel(imgView.Bounds)
{
BackgroundColor = UIColor.Clear,
TextAlignment = UITextAlignment.Center,
Tag = 1
};
label.Font = label.Font.WithSize(50);
imgView.AddSubview(label);
reusingView = imgView;
}
else
{
label = (UILabel)reusingView.ViewWithTag(1);
}
return reusingView;
}
示例9: 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);
}
示例10: FinishedLaunching
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// check is it 64bit or 32bit
Console.WriteLine (IntPtr.Size);
// Main app do nothing
// Go to Photo > Edit then choose PhotoFilter to start app extension
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.BackgroundColor = UIColor.White;
note = new UILabel ();
note.Text = "Note that the app in this sample only serves as a host for the extension. To use the sample extension, edit a photo or video using the Photos app, and tap the extension icon";
note.Lines = 0;
note.LineBreakMode = UILineBreakMode.WordWrap;
var frame = note.Frame;
note.Frame = new CGRect (0, 0, UIScreen.MainScreen.Bounds.Width * 0.75f, 0);
note.SizeToFit ();
window.AddSubview (note);
note.Center = window.Center;
window.MakeKeyAndVisible ();
return true;
}
示例11: Draw
/// <summary>
/// this is where we do the meat of creating our alert, which includes adding
/// controls, etc.
/// </summary>
public override void Draw(RectangleF rect)
{
// if the control hasn't been setup yet
if (activityIndicator == null)
{
// if we have a message
if (!string.IsNullOrEmpty (message))
{
lblMessage = new UILabel (new RectangleF (20, 10, rect.Width - 40, 33));
lblMessage.BackgroundColor = UIColor.Clear;
lblMessage.TextColor = UIColor.LightTextColor;
lblMessage.TextAlignment = UITextAlignment.Center;
lblMessage.Text = message;
this.AddSubview (lblMessage);
}
// instantiate a new activity indicator
activityIndicator = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.White);
activityIndicator.Frame = new RectangleF ((rect.Width / 2) - (activityIndicator.Frame.Width / 2)
, 50, activityIndicator.Frame.Width, activityIndicator.Frame.Height);
this.AddSubview (activityIndicator);
activityIndicator.StartAnimating ();
}
base.Draw (rect);
}
示例12: OnDrawProperties
protected override bool OnDrawProperties()
{
mLabel = mWidget as UILabel;
ComponentSelector.Draw<UIFont>(mLabel.font, OnSelectFont);
if (mLabel.font == null) return false;
string text = EditorGUILayout.TextArea(mLabel.text, GUILayout.Height(100f));
if (!text.Equals(mLabel.text)) { RegisterUndo(); mLabel.text = text; }
GUILayout.BeginHorizontal();
{
float len = EditorGUILayout.FloatField("Line Width", mLabel.lineWidth, GUILayout.Width(120f));
if (len != mLabel.lineWidth) { RegisterUndo(); mLabel.lineWidth = len; }
bool multi = EditorGUILayout.Toggle("Multi-line", mLabel.multiLine, GUILayout.Width(100f));
if (multi != mLabel.multiLine) { RegisterUndo(); mLabel.multiLine = multi; }
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
{
bool password = EditorGUILayout.Toggle("Password", mLabel.password, GUILayout.Width(120f));
if (password != mLabel.password) { RegisterUndo(); mLabel.password = password; }
bool encoding = EditorGUILayout.Toggle("Encoding", mLabel.supportEncoding, GUILayout.Width(100f));
if (encoding != mLabel.supportEncoding) { RegisterUndo(); mLabel.supportEncoding = encoding; }
}
GUILayout.EndHorizontal();
return true;
}
示例13: Update
void Update ()
{
if (mLabel == null)
{
mLabel = GetComponent<UILabel>();
mLabel.supportEncoding = false;
mLabel.symbolStyle = NGUIText.SymbolStyle.None;
mText = mLabel.processedText;
}
if (mOffset < mText.Length)
{
if (mNextChar <= RealTime.time)
{
charsPerSecond = Mathf.Max(1, charsPerSecond);
// Periods and end-of-line characters should pause for a longer time.
float delay = 1f / charsPerSecond;
char c = mText[mOffset];
if (c == '.' || c == '\n' || c == '!' || c == '?') delay *= 4f;
mNextChar = RealTime.time + delay;
mLabel.text = mText.Substring(0, ++mOffset);
}
}
else Destroy(this);
}
示例14: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
// Setup Background image
var imgView = new UIImageView (UIImage.FromBundle ("background")) {
ContentMode = UIViewContentMode.ScaleToFill,
AutoresizingMask = UIViewAutoresizing.All,
Frame = View.Bounds
};
View.AddSubview (imgView);
// Setup iCarousel view
Carousel = new iCarousel (View.Bounds) {
CarouselType = iCarouselType.CoverFlow2,
DataSource = new ControlsDataSource (this)
};
View.AddSubview (Carousel);
// Setup info label
Label = new UILabel (new RectangleF (20, 362, 280, 21)) {
BackgroundColor = UIColor.Clear,
Text = string.Empty,
TextAlignment = UITextAlignment.Center
};
View.AddSubview (Label);
}
示例15: CreateObjects
private void CreateObjects()
{
Transform transform = base.transform.Find("personInfoLayer");
this.mNameLabel = transform.Find("name").GetComponent<UILabel>();
this.mGuildNameLabel = transform.Find("guildName").GetComponent<UILabel>();
Transform transform2 = transform.Find("bg");
this.mIcon = transform2.Find("icon").GetComponent<UISprite>();
this.mQualityMask = transform2.Find("Frame").GetComponent<UISprite>();
GameObject gameObject = transform.Find("closeBtn").gameObject;
UIEventListener expr_8C = UIEventListener.Get(gameObject);
expr_8C.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_8C.onClick, new UIEventListener.VoidDelegate(this.OnCloseBtnClick));
GameObject gameObject2 = transform.Find("chatBtn").gameObject;
UIEventListener expr_C4 = UIEventListener.Get(gameObject2);
expr_C4.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_C4.onClick, new UIEventListener.VoidDelegate(this.OnChatClick));
GameObject gameObject3 = transform.Find("viewBtn").gameObject;
UIEventListener expr_FE = UIEventListener.Get(gameObject3);
expr_FE.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_FE.onClick, new UIEventListener.VoidDelegate(this.OnViewClick));
GameObject gameObject4 = transform.Find("friendBtn").gameObject;
UIEventListener expr_138 = UIEventListener.Get(gameObject4);
expr_138.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_138.onClick, new UIEventListener.VoidDelegate(this.OnFriendClick));
this.mFriendLabel = gameObject4.transform.Find("Label").GetComponent<UILabel>();
GameObject gameObject5 = transform.Find("backlistBtn").gameObject;
UIEventListener expr_18E = UIEventListener.Get(gameObject5);
expr_18E.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_18E.onClick, new UIEventListener.VoidDelegate(this.OnBacklistClick));
this.mBacklistLabel = gameObject5.transform.Find("Label").GetComponent<UILabel>();
}