本文整理汇总了C#中UILabel.AddGestureRecognizer方法的典型用法代码示例。如果您正苦于以下问题:C# UILabel.AddGestureRecognizer方法的具体用法?C# UILabel.AddGestureRecognizer怎么用?C# UILabel.AddGestureRecognizer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UILabel
的用法示例。
在下文中一共展示了UILabel.AddGestureRecognizer方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClockViewController
public ClockViewController(BedsideClock.Model.Options options)
{
this.options = options;
textView = new UILabel {
BackgroundColor = UIColor.Black,
TextColor = UIColor.Green,
Text = "12:00",
TextAlignment = UITextAlignment.Center,
UserInteractionEnabled = true,
AdjustsFontSizeToFitWidth = true
};
if (options.Font != null)
textView.Font = UIFont.FromName(options.Font, 200);
else
textView.Font = textView.Font.WithSize(200);
textView.AddGestureRecognizer(new UITapGestureRecognizer(ToggleNavigationBarVisibility));
Add(textView);
timer = new Timer(1000);
timer.AutoReset = true;
timer.Elapsed += HandleElapsed;
timer.Enabled = true;
}
示例2: NotificationBar
public NotificationBar (NSCoder coder)
: base (coder)
{
heightConstraint = NSLayoutConstraint.Create (this, Height, Equal, null, NoAttribute, 1, 0);
TranslatesAutoresizingMaskIntoConstraints = false;
BackgroundColor = UIColor.Black;
AddConstraint (heightConstraint);
label = new UILabel {
Text = "You have a new CloudKit notification!",
TextColor = UIColor.White,
TextAlignment = UITextAlignment.Center,
TranslatesAutoresizingMaskIntoConstraints = false,
Hidden = true,
UserInteractionEnabled = true
};
AddSubview (label);
button = new UIButton ();
button.SetTitle ("✕", UIControlState.Normal);
button.AddTarget (Close, UIControlEvent.TouchDown);
button.TranslatesAutoresizingMaskIntoConstraints = false;
button.Hidden = true;
AddSubview (button);
var rightConstraint = NSLayoutConstraint.Create (this, RightMargin, Equal, button, Right, 1, 0);
AddConstraint (rightConstraint);
var centerConstraint = NSLayoutConstraint.Create (this, CenterY, Equal, button, CenterY, 1, 0);
AddConstraint (centerConstraint);
var leftConstraint = NSLayoutConstraint.Create (this, LeftMargin, Equal, label, Left, 1, 0);
AddConstraint (leftConstraint);
var rightLabelConstraint = NSLayoutConstraint.Create (button, Left, Equal, label, Right, 1, 8);
AddConstraint (rightLabelConstraint);
var centerLabelConstraint = NSLayoutConstraint.Create (this, CenterY, Equal, label, CenterY, 1, 0);
AddConstraint (centerLabelConstraint);
var tapGestureRecognizer = new UITapGestureRecognizer (ShowNotification);
label.AddGestureRecognizer (tapGestureRecognizer);
}
示例3: CameraOptions
//.........这里部分代码省略.........
log ("Overlay Image: "+OverlayImage);
if (OverlayImage != null && File.Exists("./"+OverlayImage+".png")){
log ("Overlay Image: "+OverlayImage + " found!");
overlayGraphic = UIImage.FromBundle (OverlayImage+".png");
} else {
log ("Overlay Image not found");
// Load the image to show in the overlay:
overlayGraphic = UIImage.FromBundle (@"overlaygraphic.png");
}
overlayGraphic = overlayGraphic.ImageWithRenderingMode (UIImageRenderingMode.AlwaysTemplate); // convert image to template
UIImageView overlayGraphicView = new UIImageView (overlayGraphic);
overlayGraphicView.Frame = new CGRect(
overlaySettings.GuidelinesMargins,
overlaySettings.GuidelinesMargins,
frame.Width - overlaySettings.GuidelinesMargins * 2 ,
frame.Height - overlaySettings.GuidelinesMargins * 2);
log ("guidelines tint color: " + overlaySettings.GuidelinesColorHexadecimal);
UIColor color = GetUIColorfromHex (overlaySettings.GuidelinesColorHexadecimal);
if (color != null)
overlayGraphicView.TintColor = color;
this.AddSubview (overlayGraphicView);
ScanButton scanButton = new ScanButton (
new CGRect ((frame.Width / 2) - (overlaySettings.ScanButtonWidth /2), frame.Height - overlaySettings.ScanButtonHeight - overlaySettings.ScanButtonMarginBottom ,
overlaySettings.ScanButtonWidth, overlaySettings.ScanButtonHeight), overlaySettings);
scanButton.TouchUpInside += delegate(object sender, EventArgs e) {
log("Scan Button TouchUpInside... " );
controller.TakePicture();
};
this.AddSubview (scanButton);
if (overlaySettings.DescriptionLabelText != null) {
UILabel label = new UILabel (new CGRect (overlaySettings.DescriptionLabelMarginLeftRight,
frame.Height - overlaySettings.DescriptionLabelHeight - overlaySettings.DescriptionLabelMarginBottom,
frame.Width - overlaySettings.DescriptionLabelMarginLeftRight * 2, overlaySettings.DescriptionLabelHeight)); // applying "DescriptionLabelMarginLeftRight" margins to width and x position
label.Text = overlaySettings.DescriptionLabelText;
color = GetUIColorfromHex (overlaySettings.DescriptionLabelColorHexadecimal);
if(color != null)
label.TextColor = color;
label.BaselineAdjustment = UIBaselineAdjustment.AlignCenters;
label.TextAlignment = UITextAlignment.Center; // centered aligned
label.LineBreakMode = UILineBreakMode.WordWrap; // wrap text by words
label.Lines = 2;
if (overlaySettings.DescriptionLabelFontFamilyName != null) {
UIFont labelFont = UIFont.FromName (overlaySettings.DescriptionLabelFontFamilyName, overlaySettings.DescriptionLabelFontSize);
if (labelFont != null) {
label.Font = labelFont;
} else {
log ("Font family [" + overlaySettings.DescriptionLabelFontFamilyName + "] for 'DescriptionLabelFontFamilyName' not found");
}
}
this.AddSubview (label);
}
UILabel cancelLabel = new UILabel (new CGRect ((frame.Width / 4) - (overlaySettings.CancelButtonWidth /2),
frame.Height - overlaySettings.CancelButtonHeight - overlaySettings.ScanButtonMarginBottom,
overlaySettings.CancelButtonWidth, overlaySettings.CancelButtonHeight));
cancelLabel.Text = overlaySettings.CancelButtonText;
color = GetUIColorfromHex (overlaySettings.CancelButtonColorHexadecimal);
if(color != null)
cancelLabel.TextColor = color;
cancelLabel.BaselineAdjustment = UIBaselineAdjustment.AlignCenters;
cancelLabel.TextAlignment = UITextAlignment.Center; // centered aligned
// list of available ios fonts: https://developer.xamarin.com/recipes/ios/standard_controls/fonts/enumerate_fonts/
if (overlaySettings.CancelButtonFontFamilyName != null) {
UIFont cancelLabelFont = UIFont.FromName (overlaySettings.CancelButtonFontFamilyName, overlaySettings.CancelButtonFontSize);
if (cancelLabelFont != null) {
cancelLabel.Font = cancelLabelFont;
} else {
log ("Font family [" + overlaySettings.CancelButtonFontFamilyName + "] for 'CancelButtonFontFamilyName' not found");
}
}
UITapGestureRecognizer cancelLabelTap = new UITapGestureRecognizer(() => {
log("Cancel Button TouchesEnded... " );
UIApplication.SharedApplication.InvokeOnMainThread (delegate {
SystemLogger.Log(SystemLogger.Module.PLATFORM, "Canceled picking image ");
IPhoneUtils.GetInstance().FireUnityJavascriptEvent("Appverse.Media.onFinishedPickingImage", null);
IPhoneServiceLocator.CurrentDelegate.MainUIViewController ().DismissModalViewController(true);
});
});
cancelLabel.UserInteractionEnabled = true;
cancelLabel.AddGestureRecognizer(cancelLabelTap);
this.AddSubview (cancelLabel);
}
示例4: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
this.View.BackgroundColor = UIColor.White;
CGRect parentBounds = this.View.Bounds;
float yPos = 80f;
UILabel content = new UILabel(RectangleF.Empty);
content.Text = "Essential Studio for iOS is a collection of user interface and file format manipulation components, that can be used to build line-of-business mobile applications.";
content.Lines = 0;
content.LineBreakMode = UILineBreakMode.WordWrap;
content.Font = UIFont.FromName("Helvetica neue", 14f);
content.ClipsToBounds = true;
content.BackgroundColor = UIColor.Clear;
content.TextColor = UIColor.FromRGB (137,137,137);
content.TextAlignment = UITextAlignment.Left;
CGRect contentFrame = new CGRect();
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) {
contentFrame = new CGRect (23, yPos, parentBounds.Size.Width - 46, 50);
yPos += 60;
}
else {
contentFrame = new CGRect (23, yPos, parentBounds.Size.Width - 46, 80);
yPos += 90;
}
content.Frame = contentFrame;
this.View.AddSubview (content);
UILabel version = new UILabel(RectangleF.Empty);
version.Text = "Version 13.3.0.7";
version.Lines = 1;
version.Font = UIFont.FromName("Helvetica neue", 14f);
version.ClipsToBounds = true;
version.BackgroundColor = UIColor.Clear;
version.TextColor = UIColor.FromRGB (137,137,137);
version.TextAlignment = UITextAlignment.Left;
CGSize versionSize = this.measureLabel (version);
version.Frame = new CGRect (23, yPos, versionSize.Width, versionSize.Height);
yPos += (float)versionSize.Height + 30;
this.View.AddSubview (version);
UILabel contact = new UILabel(RectangleF.Empty);
contact.Text = "Contact Us";
contact.Lines = 1;
contact.Font = UIFont.FromName("Helvetica neue", 17f);
contact.ClipsToBounds = true;
contact.BackgroundColor = UIColor.Clear;
contact.TextColor = UIColor.Gray;
contact.TextAlignment = UITextAlignment.Left;
CGSize contactSize = this.measureLabel (contact);
contact.Frame = new CGRect (23, yPos, contactSize.Width, contactSize.Height);
yPos += (float)contactSize.Height + 20;
this.View.AddSubview (contact);
UILabel web = new UILabel (RectangleF.Empty);
web.AttributedText = new NSAttributedString (
"http://www.syncfusion.com",
underlineStyle: NSUnderlineStyle.Single);
web.Lines = 1;
web.Font = UIFont.FromName("Helvetica neue", 14f);
web.ClipsToBounds = false;
web.BackgroundColor = UIColor.Clear;
web.TextColor = UIColor.FromRGB (137,137,137);
web.TextAlignment = UITextAlignment.Left;
CGSize webSize = this.measureLabel (web);
web.Frame = new CGRect (23, yPos, webSize.Width+20, webSize.Height);
web.UserInteractionEnabled = true;
yPos += (float)webSize.Height+15;
var tap = new UITapGestureRecognizer();
tap.AddTarget(() => UIApplication.SharedApplication.OpenUrl(new NSUrl(web.Text)));
tap.NumberOfTapsRequired = 1;
tap.DelaysTouchesBegan = true;
web.AddGestureRecognizer(tap);
View.AddSubview (web);
UILabel support = new UILabel(RectangleF.Empty);
support.Text = "[email protected]";
support.AttributedText = new NSAttributedString (
"[email protected]",
underlineStyle: NSUnderlineStyle.Single);
support.Lines = 1;
support.Font = UIFont.FromName("Helvetica neue", 14f);
support.ClipsToBounds = true;
support.BackgroundColor = UIColor.Clear;
support.TextColor = UIColor.FromRGB (137,137,137);
support.TextAlignment = UITextAlignment.Left;
CGSize supportSize = this.measureLabel (support);
support.Frame = new CGRect (23, yPos, supportSize.Width, supportSize.Height);
support.UserInteractionEnabled = true;
yPos += (float)supportSize.Height+15;
var tapSupport = new UITapGestureRecognizer();
tapSupport.AddTarget(() => UIApplication.SharedApplication.OpenUrl(new NSUrl("mailto:[email protected]")));
tapSupport.NumberOfTapsRequired = 1;
tapSupport.DelaysTouchesBegan = true;
support.AddGestureRecognizer(tapSupport);
//.........这里部分代码省略.........
示例5: SetupPhotos
void SetupPhotos()
{
nfloat height = this.Frame.Size.Height;
nfloat width = this.Frame.Size.Width;
cp_mask = new UIView(new CGRect(0, 0, width, height * Constants.CP_RATIO));
pp_mask = new UIView(new CGRect(width * Constants.PP_X_RATIO, height * Constants.PP_Y_RATIO, height * Constants.PP_RATIO, height * Constants.PP_RATIO));
pp_circle = new UIView(new CGRect(pp_mask.Frame.Location.X - Constants.PP_BUFF, pp_mask.Frame.Location.Y - Constants.PP_BUFF, pp_mask.Frame.Size.Width + 2 * Constants.PP_BUFF, pp_mask.Frame.Size.Height + 2 * Constants.PP_BUFF));
pp_circle.BackgroundColor = UIColor.White;
pp_circle.Layer.CornerRadius = pp_circle.Frame.Size.Height / 2;
pp_mask.Layer.CornerRadius = pp_mask.Frame.Size.Height / 2;
cp_mask.BackgroundColor = new UIColor(0.98f, 0.98f, 0.98f, 1);
nfloat cornerRadius = this.Layer.CornerRadius;
UIBezierPath maskPath = UIBezierPath.FromRoundedRect(cp_mask.Bounds, UIRectCorner.TopLeft | UIRectCorner.TopRight, new CGSize(cornerRadius, cornerRadius));
CAShapeLayer maskLayer = new CAShapeLayer();
maskLayer.Frame = cp_mask.Bounds;
maskLayer.Path = maskPath.CGPath;
cp_mask.Layer.Mask = maskLayer;
UIBlurEffect blurEffect = UIBlurEffect.FromStyle(UIBlurEffectStyle.Light);
visualEffectView = new UIVisualEffectView(blurEffect);
visualEffectView.Frame = cp_mask.Frame;
visualEffectView.Alpha = 0;
profileImageView = new UIImageView();
profileImageView.Frame = new CGRect(0, 0, pp_mask.Frame.Size.Width, pp_mask.Frame.Size.Height);
coverImageView = new UIImageView();
coverImageView.Frame = cp_mask.Frame;
coverImageView.ContentMode = UIViewContentMode.ScaleAspectFill;
cp_mask.AddSubview(coverImageView);
pp_mask.AddSubview(profileImageView);
cp_mask.ClipsToBounds = true;
pp_mask.ClipsToBounds = true;
// setup the label
nfloat titleLabelX = pp_circle.Frame.Location.X + pp_circle.Frame.Size.Width;
titleLabel = new UILabel(new CGRect(titleLabelX, cp_mask.Frame.Size.Height + 7, this.Frame.Size.Width - titleLabelX, 26));
titleLabel.AdjustsFontSizeToFitWidth = false;
titleLabel.LineBreakMode = UILineBreakMode.Clip;
titleLabel.Font = UIFont.FromName("HelveticaNeue-Light", 20);
titleLabel.TextColor = new UIColor(0, 0, 0, 0.8f);
titleLabel.Text = "Title Label";
titleLabel.UserInteractionEnabled = true;
UITapGestureRecognizer tapGesture = new UITapGestureRecognizer(this.TitleLabelTap);
titleLabel.AddGestureRecognizer(tapGesture);
coverImageView.UserInteractionEnabled = true;
UITapGestureRecognizer tapGestureCover = new UITapGestureRecognizer(this.CoverPhotoTap);
coverImageView.AddGestureRecognizer(tapGestureCover);
profileImageView.UserInteractionEnabled = true;
UITapGestureRecognizer tapGestureProfile = new UITapGestureRecognizer(this.ProfilePhotoTap);
profileImageView.AddGestureRecognizer(tapGestureProfile);
this.AddSubview(titleLabel);
this.AddSubview(cp_mask);
this.AddSubview(pp_circle);
this.AddSubview(pp_mask);
coverImageView.AddSubview(visualEffectView);
}
示例6: ViewQualityMetrics
//.........这里部分代码省略.........
QMValidation searchItem = IsRequiredlabels.Find(x => x.proctAttribTypeID == 607);
if(searchItem == null){
IsRequiredlabels.Add(asa8ItemRemovedPrev);
foreach (QMValidation item in IsRequiredlabels) {
if(item.proctAttribTypeID == 607){
item.lbldesc.Layer.BorderColor = UIColor.Red.CGColor;
item.lbldesc.Layer.BorderWidth = 1;
}
}
}
}
}
};
if(procedureDetails != null && procedureDetails.ID != 0)
qmFrm.ProcID=procedureDetails.ID ;
qmFrm.PresentFromPopover(lblDesc, (float)lblDesc.Frame.X, (float)lblDesc.Frame.Y);
}else{
if(masterMainList.Count>0)
qmBindPopupover(masterMainList,lblDesc,(int)lblDesc.Frame.Y,tempAttribTypeID);
}
int ProcID=0;
if(procedureDetails != null && procedureDetails.ID != 0)
ProcID = procedureDetails.ID;
iProPQRSPortableLib.Consts.SelectedProcAttribtslist = await AppDelegate.Current.pqrsMgr.GetAllAttribTypesOfAProcedure(ProcID);
//IsRequiredlabels
});
lblDesc.UserInteractionEnabled = true;
lblDesc.AddGestureRecognizer(lblDescTap);
//UIButton btncontrol = new UIButton (new CoreGraphics.CGRect (550, 8, 319, 30));
//if(!string.IsNullOrEmpty(selectedtext))
// btncontrol.SetTitle (selectedtext, UIControlState.Normal);
//btncontrol.SetBackgroundImage (UIImage.FromFile (@"textBoxDropDown.png"), UIControlState.Normal);
//btncontrol.SetTitleColor (UIColor.Black, UIControlState.Normal);
//btncontrol.TouchUpInside += async (object sender, EventArgs e) => {
// List<string> selectedi=new List<string>{"selected"};
//string name=Types [i].Label;
// if(AttribTypeID== 608)
//{
//if(Dropdownlist.Count>0)
//BindmultilevelPopupover(Dropdownlist,selectedi,btncontrol,(int)btncontrol.Frame.Y,"name");
//}
//else
//{
//if(Dropdownlist.Count>0)
// BindPopupover(Dropdownlist,selectedi,btncontrol,(int)btncontrol.Frame.Y,"name");
//}
//};
//btncontrol.SetTitle (" btn Name " + i, UIControlState.Normal);
if (Types [i].IsRequired) {
// lblDesc.Layer.BorderColor = UIColor.FromRGB (255, 102, 102).CGColor;
lblDesc.Layer.BorderColor = UIColor.Red.CGColor;
lblDesc.Layer.BorderWidth = 1;
QMValidation v=new QMValidation();
v.lbldesc = lblDesc;
v.lblname = HeaderTitle;
v.proctAttribTypeID = Types [i].ProcAttribTypeID;
示例7: ViewDidLoad
/// <summary>
/// Views the did load.
/// </summary>
public override void ViewDidLoad()
{
base.ViewDidLoad ();
//
m_navigationTitle = @"Audio Recorder";
//
this.View.TintColor = NormalTintColor;
mMusicFlowView.BackgroundColor = this.View.BackgroundColor;
mMusicFlowView.IdleAmplitude = 0;
//Unique recording URL
var fileName = NSProcessInfo.ProcessInfo.GloballyUniqueString;
var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
var tmp = Path.Combine (documents, "..", "tmp");
m_recordingFilePath = Path.Combine(tmp,String.Format("{0}.m4a",fileName));
{
m_flexItem1 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace,null,null);
m_flexItem2 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace,null,null);
var img = UIImage.FromBundle("audio_record");
m_recordButton = new UIBarButtonItem(img,UIBarButtonItemStyle.Plain,RecordingButtonAction);
m_playButton = new UIBarButtonItem(UIBarButtonSystemItem.Play,PlayAction);
m_pauseButton = new UIBarButtonItem(UIBarButtonSystemItem.Pause,PauseAction);
m_trashButton = new UIBarButtonItem(UIBarButtonSystemItem.Trash,DeleteAction);
this.SetToolbarItems (new UIBarButtonItem[]{ m_playButton, m_flexItem1, m_recordButton, m_flexItem2, m_trashButton}, false);
m_playButton.Enabled = false;
m_trashButton.Enabled = false;
}
// Define the recorder setting
{
var audioSettings = new AudioSettings () {
Format = AudioFormatType.MPEG4AAC,
SampleRate = 44100.0f,
NumberChannels = 2,
};
NSError err = null;
m_audioRecorder = AVAudioRecorder.Create (NSUrl.FromFilename (m_recordingFilePath), audioSettings,out err);
// Initiate and prepare the recorder
m_audioRecorder.WeakDelegate = this;
m_audioRecorder.MeteringEnabled = true;
mMusicFlowView.PrimaryWaveLineWidth = 3.0f;
mMusicFlowView.SecondaryWaveLineWidth = 1.0f;
}
//Navigation Bar Settings
{
this.NavigationItem.Title = @"Audio Recorder";
m_cancelButton = new UIBarButtonItem(UIBarButtonSystemItem.Cancel,CancelAction);
this.NavigationItem.LeftBarButtonItem = m_cancelButton;
m_doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, DoneAction);
}
//Player Duration View
{
m_viewPlayerDuration = new UIView ();
m_viewPlayerDuration.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
m_viewPlayerDuration.BackgroundColor = UIColor.Clear;
m_labelCurrentTime = new UILabel ();
m_labelCurrentTime.Text = NSStringExtensions.TimeStringForTimeInterval (0);
m_labelCurrentTime.Font = UIFont.BoldSystemFontOfSize(14.0f);
m_labelCurrentTime.TextColor = NormalTintColor;
m_labelCurrentTime.TranslatesAutoresizingMaskIntoConstraints = false;
m_playerSlider = new UISlider(new CGRect(0, 0, this.View.Bounds.Size.Width, 64));
m_playerSlider.MinimumTrackTintColor = PlayingTintColor;
m_playerSlider.Value = 0;
m_playerSlider.TouchDown += SliderStart;
m_playerSlider.ValueChanged += SliderMoved;
m_playerSlider.TouchUpInside += SliderEnd;
m_playerSlider.TouchUpOutside += SliderEnd;
m_playerSlider.TranslatesAutoresizingMaskIntoConstraints = false;
m_labelRemainingTime = new UILabel();
m_labelCurrentTime.Text = NSStringExtensions.TimeStringForTimeInterval (0);
m_labelRemainingTime.UserInteractionEnabled = true;
m_labelRemainingTime.AddGestureRecognizer (new UITapGestureRecognizer(TapRecognizer));
m_labelRemainingTime.Font = m_labelCurrentTime.Font;
m_labelRemainingTime.TextColor = m_labelCurrentTime.TextColor;
m_labelRemainingTime.TranslatesAutoresizingMaskIntoConstraints = false;
m_viewPlayerDuration.Add (m_labelCurrentTime);
//.........这里部分代码省略.........
开发者ID:chapayGhub,项目名称:IQAudioRecorderControllerDotNet,代码行数:101,代码来源:IQInternalAudioRecorderController.cs
示例8: initialize
void initialize(UIViewController controller)
{
var nav = controller as UINavigationController;
if (nav == null && controller.NavigationController != null)
nav = controller.NavigationController;
if (nav != null) {
navBar = nav.NavigationBar;
navController = nav;
}
var nc = NSNotificationCenter.DefaultCenter;
observers.Add (nc.AddObserver (UIDevice.OrientationDidChangeNotification, OrientationDidChange));
rootView = new UIView (controller.View.Bounds);
rootView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
controllerView = controller.View;
controllerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
if (controllerView.Superview != null)
controllerView.RemoveFromSuperview ();
rootView.AddSubview (controllerView);
var statusBarHeight = GetStatusBarHeight ();
baseView = new UIView (new RectangleF (0, 0, controller.View.Bounds.Width, BAR_HEIGHT + statusBarHeight));
labelText = new UILabel (new RectangleF (0, statusBarHeight, baseView.Frame.Width - BUTTON_WIDTH, BAR_HEIGHT));
labelText.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
labelText.Font = UIFont.SystemFontOfSize (UIFont.SmallSystemFontSize);
labelText.TextAlignment = UITextAlignment.Center;
labelText.UserInteractionEnabled = true;
labelText.Text = lblText;
buttonClose = new UIButton (UIButtonType.Custom);
buttonClose.Frame = new RectangleF (labelText.Frame.Right, statusBarHeight, BUTTON_WIDTH, BUTTON_WIDTH);
buttonClose.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin;
baseView.AddSubviews (labelText, buttonClose);
//baseView.Frame = new RectangleF (baseView.Frame.X, baseView.Frame.Y, baseView.Frame.Width, 0f);
controller.View = rootView;
controller.View.AddSubview (baseView);
controller.View.BringSubviewToFront (baseView);
if (navController != null && navBar != null) {
navBar.ClipsToBounds = false;
navController.View.ClipsToBounds = false;
navController.View.AddSubview (baseView);
navController.View.BringSubviewToFront (baseView);
}
else
rootView.AddSubview (baseView);
AttachedToController = controller;
buttonClose.TouchUpInside += delegate {
var evt = OnClosedRefererOverlay;
if (evt != null)
evt();
};
tapGestureLabel = new UITapGestureRecognizer (async g => {
await OpenRefererAppLink(RefererLink);
});
labelText.AddGestureRecognizer (tapGestureLabel);
UpdateColors ();
}
示例9: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
View.BackgroundColor = UIColor.White;
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
part.PartName.ToLower ();
var scrollView = new UIScrollView {
Frame = new CGRect (0, 0, 320, View.Frame.Height * 1.5)
} ;
var partNameLabel = new UILabel {
Font = UIFont.FromName ("SegoeUI-Light", 25f),
Frame = new CGRect (20, 5, View.Bounds.Width, 30),
Text = textInfo.ToTitleCase (part.PartName.ToLower ())
} ;
var partMakeLabel = new UILabel {
Font = UIFont.FromName ("SegoeUI-Light", 23f),
Frame = new CGRect (20, 35, View.Bounds.Width, 25),
Text = partString
};
var priceLabel = new UILabel {
Font = UIFont.FromName ("SegoeUI-Light", 24f),
Frame = new CGRect (View.Bounds.Width - 80, 17.5, 70, 30),
Text = string.Format ("${0}", part.Price),
TextAlignment = UITextAlignment.Right
} ;
var williesGuarentee = new UILabel {
Font = UIFont.FromName ("SegoeUI-Light", 15f),
Frame = new CGRect (0, 65, View.Bounds.Width, 20),
Text = "Willie's Guarentee",
TextAlignment = UITextAlignment.Center
} ;
var guarenteeOne = new UILabel {
Font = UIFont.FromName ("SegoeUI-Light", 11f),
Frame = new CGRect (20, 85, View.Bounds.Width - 40, 50),
Lines = 10,
Text = "Why go anywhere else? With over 10 million satisified customers in more than 28 years, Willie’s is your best bet for the quality part you are looking for."
} ;
var guarenteeTwo = new UILabel {
Font = UIFont.FromName ("SegoeUI-Light", 11f),
Frame = new CGRect (20, 140, View.Bounds.Width - 40, 50),
Lines = 5,
Text = "Willie’s ships parts daily to many satisified customers. We can ship international, next day air, two day air, three day select, and to post office boxes."
} ;
var guarenteeThree = new UILabel {
Font = UIFont.FromName ("SegoeUI-Light", 11f),
Frame = new CGRect (20, 205, View.Bounds.Width - 40, 50),
Lines = 5,
Text = "We give full refunds or exchange on parts arriving defective and will accept returns on incorrect parts. We do have a restock fee of only 20% if you misorder a part."
} ;
var contactButton = new ContactUsButton {
Frame = new CGRect (40, 260, View.Bounds.Width - 80, 40)
} ;
contactButton.SetTitle ("Contact Us", UIControlState.Normal);
contactButton.SetTitleColor (UIColor.White, UIControlState.Normal);
contactButton.TouchUpInside += CancelButtonTapped;
var payButton = new SearchButton {
Frame = new CGRect (40, 310, View.Bounds.Width - 80, 40)
} ;
payButton.SetTitle ("Buy Part", UIControlState.Normal);
payButton.SetTitleColor (UIColor.White, UIControlState.Normal);
payButton.TouchUpInside += PaymentButtonTapped;
var payText = new UILabel {
Frame = new CGRect (40, 350, View.Bounds.Width - 80, 50),
Text = "By purchasing part(s) from Willie's Cycles, you agree to the Terms of Service (tap to view).",
Font = UIFont.FromName ("SegoeUI-Light", 12f),
Lines = 5,
TextAlignment = UITextAlignment.Center,
UserInteractionEnabled = true
};
payTextTouched = new UITapGestureRecognizer (PayTextTapped) {
NumberOfTapsRequired = 1
};
payText.AddGestureRecognizer (payTextTouched);
scrollView.Add (partNameLabel);
scrollView.Add (priceLabel);
scrollView.Add (partMakeLabel);
scrollView.Add (williesGuarentee);
scrollView.Add (guarenteeOne);
scrollView.Add (guarenteeTwo);
scrollView.Add (guarenteeThree);
scrollView.Add (contactButton);
scrollView.Add (payButton);
scrollView.Add (payText);
scrollView.ContentSize = new CGSize (View.Frame.Width, View.Frame.Height * 1.25);
//.........这里部分代码省略.........
示例10: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
BTProgressHUD.Dismiss ();
activeField = ActiveField.Player;
Round = AppDelegate.Self.ApiClient.Get (new GetRound { Id = AppDelegate.Self.CurrentRoundId });
Machines = AppDelegate.Self.ApiClient.Get (new GetMachinesInRound { Id = Round.Id });
if (Machines.Count == 0)
AppDelegate.Self.ShowModalAlertViewAsync ("No games found.");
_backgroundViewHeight = UIScreen.MainScreen.Bounds.Height;
_backgroundViewWidth = UIScreen.MainScreen.Bounds.Width;
labelh = 50.0f;
nfloat labelx = 70;
nfloat labely = 120;
playerLabel = new UILabel {
Text = "Player",
BackgroundColor = UIColor.Clear,
TextColor = UIColor.White,
Font = UIFont.FromName ("Arial", 16F),
Frame = new CGRect(labelx, labely, _backgroundViewWidth - labelx, labelh),
UserInteractionEnabled = true
};
playerLabel.AddGestureRecognizer (
new UITapGestureRecognizer (() => {
setFocus(playerLabel);
}));
playerNumberLabel = new UILabel {
BackgroundColor = UIColor.Clear,
TextColor = UIColor.FromRGB(84, 164, 224),
Font = UIFont.FromName ("Arial-BoldMT", 35F),
Frame = new CGRect((_backgroundViewWidth / 2) - 130, labely, 100, labelh),
Hidden = true
};
playerNameLabel = new UILabel {
BackgroundColor = UIColor.Clear,
TextColor = UIColor.FromRGB(84, 164, 224),
Font = UIFont.FromName ("Arial", 16F),
Frame = new CGRect((_backgroundViewWidth / 2) - 20, labely, 400, labelh),
Hidden = true
};
inputField = new UITextField
{
Placeholder = "|",
BackgroundColor = UIColor.FromRGB(41, 57, 69),
TextColor = UIColor.White,
Font = UIFont.FromName ("Arial", 30F),
BorderStyle = UITextBorderStyle.RoundedRect,
Frame = new CGRect((_backgroundViewWidth / 2) - 130, labely, 100, labelh),
UserInteractionEnabled = false,
TextAlignment = UITextAlignment.Center
};
labely += 140;
gameLabel = new UILabel {
Text = "Game",
BackgroundColor = UIColor.Clear,
TextColor = UIColor.FromRGB(84, 164, 224),
Font = UIFont.FromName ("Arial", 16f),
Frame = new CGRect(labelx, labely, _backgroundViewWidth - labelx, labelh),
UserInteractionEnabled = true
};
gameLabel.AddGestureRecognizer (
new UITapGestureRecognizer (() => {
setFocus(gameLabel);
}));
gameNumberLabel = new UILabel {
BackgroundColor = UIColor.Clear,
TextColor = UIColor.FromRGB(84, 164, 224),
Font = UIFont.FromName ("Arial-BoldMT", 35F),
Frame = new CGRect((_backgroundViewWidth / 2) - 130, labely, 100, labelh),
Hidden = false
};
gameNameLabel = new UILabel {
BackgroundColor = UIColor.Clear,
TextColor = UIColor.FromRGB(84, 164, 224),
Font = UIFont.FromName ("Arial", 16F),
Frame = new CGRect((_backgroundViewWidth / 2) - 20, labely, 400, labelh),
Hidden = false
};
labely += 140;
scoreLabel = new UILabel {
Text = "Score",
BackgroundColor = UIColor.Clear,
TextColor = UIColor.FromRGB(84, 164, 224),
Font = UIFont.FromName ("Arial", 16f),
Frame = new CGRect(labelx, labely, _backgroundViewWidth - labelx, labelh),
UserInteractionEnabled = true
};
scoreLabel.AddGestureRecognizer (
new UITapGestureRecognizer (() => {
//.........这里部分代码省略.........
示例11: CreateLabel
protected UILabel CreateLabel(string text = null, UITapGestureRecognizer tapGestureRecognizer = null)
{
var label = new UILabel {
Text = text,
TextAlignment = UITextAlignment.Left,
Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font10_5Pt),
TextColor = UIColor.DarkGray,
BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
};
if (tapGestureRecognizer != null)
{
label.UserInteractionEnabled = true;
label.AddGestureRecognizer(tapGestureRecognizer);
}
this.ApplyDebugUIAttributes(label);
return label;
}
示例12: ViewQualityMetrics
//.........这里部分代码省略.........
}
}
else
lblDesc.Text = selectedtext;
lblDesc.Layer.BorderColor = UIColor.Gray.CGColor;
lblDesc.Layer.BorderWidth = (nfloat)0.5;
lblDesc.Layer.CornerRadius = (nfloat)8.0;
UILabel lblhidenmaincatval = new UILabel ();
lblhidenmaincatval.Hidden = true;
lblhidenmaincatval.Text = Attriblabel;
lblhidenmaincatval.Tag = AttribTypeID;
UILabel lblhidensubcatval = new UILabel ();
lblhidensubcatval.Hidden = true;
UITapGestureRecognizer lblDescTap = new UITapGestureRecognizer( async() => {
List<Tuple<string, string>> selectedrootitem=new List<Tuple<string, string>>();
if(lblhidenmaincatval.Tag != 0)
selectedrootitem.Add(new Tuple<string,string>(lblhidenmaincatval.Tag.ToString(),lblhidenmaincatval.Text));//,);
//string name=Types [i].Label;
if(mlpopid== 608)
{
if(masterMainList.Count>0)
BindmultilevelPopupover(masterMainList,selectedrootitem,selectednonPqrsTypeAS10OptionsIds,lblDesc,(int)lblDesc.Frame.Y,lblhidenmaincatval,true);
}
else if(mlpopid== 686 || mlpopid== 685 || mlpopid== 687)
{ //605=686
QualityMetricsASA qmasafrm=new QualityMetricsASA(lblDesc);
qmasafrm.masterMainList=masterMainList;
qmasafrm.masterSubCatList=masterSubCatList;
if(procedureDetails != null && procedureDetails.ID != 0)
qmasafrm.ProcID=procedureDetails.ID ;
qmasafrm.PresentFromPopover(lblDesc, (float)lblDesc.Frame.X, (float)lblDesc.Frame.Y);
//if(masterMainList.Count>0)
// BindmultilevelPopupover(masterMainList,masterSubCatList,lblDesc,(int)lblDesc.Frame.Y,lblhidenmaincatval,lblhidensubcatval,false,TypeItemID,TypeValue);
}else if(mlpopid == 606){
QualityMetricsForm qmFrm = new QualityMetricsForm();
if(procedureDetails != null && procedureDetails.ID != 0)
qmFrm.ProcID=procedureDetails.ID ;
qmFrm.PresentFromPopover(lblDesc, (float)lblDesc.Frame.X, (float)lblDesc.Frame.Y);
}else{
if(masterMainList.Count>0)
BindPopupover(masterMainList,selectedrootitem,lblDesc,(int)lblDesc.Frame.Y,lblhidenmaincatval);
}
int ProcID=0;
if(procedureDetails != null && procedureDetails.ID != 0)
ProcID = procedureDetails.ID;
iProPQRSPortableLib.Consts.SelectedProcAttribtslist = await AppDelegate.Current.pqrsMgr.GetAllAttribTypesOfAProcedure(ProcID);
});
lblDesc.UserInteractionEnabled = true;
lblDesc.AddGestureRecognizer(lblDescTap);
//UIButton btncontrol = new UIButton (new CoreGraphics.CGRect (550, 8, 319, 30));
//if(!string.IsNullOrEmpty(selectedtext))
// btncontrol.SetTitle (selectedtext, UIControlState.Normal);
//btncontrol.SetBackgroundImage (UIImage.FromFile (@"textBoxDropDown.png"), UIControlState.Normal);
//btncontrol.SetTitleColor (UIColor.Black, UIControlState.Normal);
//btncontrol.TouchUpInside += async (object sender, EventArgs e) => {
// List<string> selectedi=new List<string>{"selected"};
//string name=Types [i].Label;
// if(AttribTypeID== 608)
//{
//if(Dropdownlist.Count>0)
//BindmultilevelPopupover(Dropdownlist,selectedi,btncontrol,(int)btncontrol.Frame.Y,"name");
//}
//else
//{
//if(Dropdownlist.Count>0)
// BindPopupover(Dropdownlist,selectedi,btncontrol,(int)btncontrol.Frame.Y,"name");
//}
//};
//btncontrol.SetTitle (" btn Name " + i, UIControlState.Normal);
uvcontrol.Add (lblname);
uvcontrol.Add (lblDesc);
uvcontrol.Add (lblhidenmaincatval);
uvcontrol.Add (lblhidensubcatval);
yuvc = yuvc + 45;
uvBlock.Add (uvcontrol);
uvcontrol = null;
}
}
uvBlock.Frame = new CoreGraphics.CGRect (0, 0, 992, yuvc + 45);
uvBlock.Layer.BorderColor = UIColor.Gray.CGColor;
uvBlock.Layer.BorderWidth = 1;
//new CoreGraphics.CGRect(xUV,0,992,hUV
hUV = yuvc + 45;
finalView.Frame = new CoreGraphics.CGRect (0,yUV,992, hUV);
finalView.BackgroundColor = UIColor.White;
yUV = yUV+hUV+5;
finalView.Add (uvBlock);
svQualityMetrics.Add(finalView);
}