本文整理汇总了C#中UIButton.SetTitleShadowColor方法的典型用法代码示例。如果您正苦于以下问题:C# UIButton.SetTitleShadowColor方法的具体用法?C# UIButton.SetTitleShadowColor怎么用?C# UIButton.SetTitleShadowColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIButton
的用法示例。
在下文中一共展示了UIButton.SetTitleShadowColor方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSiteUrl
public void AddSiteUrl(RectangleF frame)
{
url = UIButton.FromType(UIButtonType.Custom);
url.LineBreakMode = UILineBreakMode.TailTruncation;
url.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
url.TitleShadowOffset = new SizeF(0, 1);
url.SetTitleColor(UIColor.FromRGB (0x32, 0x4f, 0x85), UIControlState.Normal);
url.SetTitleColor(UIColor.Red, UIControlState.Highlighted);
url.SetTitleShadowColor(UIColor.White, UIControlState.Normal);
url.AddTarget(delegate { if (UrlTapped != null) UrlTapped (); }, UIControlEvent.TouchUpInside);
// Autosize the bio URL to fit available space
var size = _urlSize;
var urlFont = UIFont.BoldSystemFontOfSize(size);
var urlSize = new NSString(_bio.Url).StringSize(urlFont);
var available = Util.IsPad() ? 400 : 185; // Util.IsRetina() ? 185 : 250;
while(urlSize.Width > available)
{
urlFont = UIFont.BoldSystemFontOfSize(size--);
urlSize = new NSString(_bio.Url).StringSize(urlFont);
}
url.Font = urlFont;
url.Frame = new RectangleF ((float)_left, (float)70, (float)(frame.Width - _left), (float)size);
url.SetTitle(_bio.Url, UIControlState.Normal);
url.SetTitle(_bio.Url, UIControlState.Highlighted);
AddSubview(url);
}
示例2: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
View.BackgroundColor = UIColor.DarkGray;
passAvailable = new UITextView (new RectangleF (20, 100, 300, 200));
passAvailable.Font = UIFont.SystemFontOfSize(14f);
passAvailable.BackgroundColor = UIColor.Clear;
passAvailable.TextColor = UIColor.White;
passAvailable.Editable = false;
Add (passAvailable);
var topOfButton = View.Frame.Height - 160;
showPass = UIButton.FromType (UIButtonType.Custom);
showPass.Frame = new RectangleF(60, topOfButton, 200, 40);
showPass.Layer.CornerRadius = 7f;
showPass.Layer.MasksToBounds = true;
showPass.Layer.BorderColor = new MonoTouch.CoreGraphics.CGColor(0.8f, 1.0f);
showPass.Layer.BorderWidth = 1;
showPass.SetTitle ("Open in Passbook", UIControlState.Normal);
showPass.BackgroundColor = UIColor.DarkGray;
showPass.SetTitleColor(UIColor.White, UIControlState.Normal);
showPass.SetTitleShadowColor (UIColor.Black, UIControlState.Normal);
showPass.TitleShadowOffset = new SizeF(1,1);
showPass.SetTitleColor(UIColor.LightGray, UIControlState.Highlighted);
showPass.TouchUpInside += (sender, e) => {
UIApplication.SharedApplication.OpenUrl (currentPass.PassUrl);
};
Add (showPass);
passHeading = new UILabel (new RectangleF (10, 40, 310, 80));
passHeading.Text = "No Event Ticket\nin Passbook";
passHeading.Lines = 2;
passHeading.TextAlignment = UITextAlignment.Center;
passHeading.Font = UIFont.SystemFontOfSize(24f);
passHeading.BackgroundColor = UIColor.Clear;
passHeading.TextColor = UIColor.White;
passHeading.ShadowColor= UIColor.Black;
passHeading.ShadowOffset = new SizeF(1,1);
Add (passHeading);
passImage = new UIImageView (new RectangleF(90,120,147,186));
passImage.Image = UIImage.FromBundle("Images/NoTicketSlash");
Add (passImage);
library = new PKPassLibrary ();
noteCenter = NSNotificationCenter.DefaultCenter.AddObserver (PKPassLibrary.DidChangeNotification, (not) => {
BeginInvokeOnMainThread (() => {
// refresh the pass
passes = library.GetPasses ();
RenderPass(passes);
});
}, library); // IMPORTANT: must pass the library in
passes = library.GetPasses ();
RenderPass(passes);
}
示例3: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Add a button via code
var button = new UIButton(UIButtonType.System);
button.Frame = new CGRect (ClickMeButton.Frame.Left, ClickMeButton.Frame.Top+ClickMeButton.Frame.Height+25, ClickMeButton.Frame.Width, ClickMeButton.Frame.Height);
button.SetTitle ("Hello", UIControlState.Normal);
button.AllEvents += (sender, e) => {
Console.WriteLine("Hello button clicked!");
};
button.SetTitleColor (UIColor.Red, UIControlState.Normal);
button.SetTitleShadowColor(UIColor.Black, UIControlState.Normal);
button.ReverseTitleShadowWhenHighlighted = true;
View.AddSubview (button);
}
示例4: StyleButton
/// <summary>
/// Style a button.
/// </summary>
/// <param name="button">Button.</param>
public static void StyleButton(UIButton button)
{
button.SetBackgroundImage(new UIImage("button_iPhone.png"), UIControlState.Normal);
// Text color + size
button.Font = UIFont.FromName("HelveticaNeue", 15);
button.SetTitleColor(UIColor.White, UIControlState.Normal);
button.SetTitleColor(UIColor.FromHSB(0, 0, 0.8f), UIControlState.Highlighted);
// Shadow color + offset
button.SetTitleShadowColor(PXNConstants.HALF_ALPHA_BLACK, UIControlState.Normal);
button.TitleShadowOffset = new SizeF(0, 1);
// Edge
button.TitleEdgeInsets = new UIEdgeInsets(0, 5, 0, 5);
// Alignement + wrap
button.TitleLabel.LineBreakMode = UILineBreakMode.WordWrap;
button.TitleLabel.TextAlignment = UITextAlignment.Center;
}
示例5: BuildLayout
private void BuildLayout(){
this.View.BackgroundColor = UIColor.Red;
//- Add Logo
UIImage ideabagLogo = UIImage.FromBundle("Login-Logo").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
UIImageView ideabagLogView = new UIImageView (ideabagLogo);
ideabagLogView.Frame = new CoreGraphics.CGRect (97, 31, 184, 294);
this.View.Add (ideabagLogView);
//- Signup Image
UIButton btnSignupImage = new UIButton();
btnSignupImage.Frame = new CoreGraphics.CGRect (194, 313, 150, 50);
UIImage signupImage = UIImage.FromBundle ("btnSignup-unselected").ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal);
UIImageView signupImageView = new UIImageView (signupImage);
btnSignupImage.Add (signupImageView);
this.View.Add (btnSignupImage);
//- Username text box and background
UIImageView usernameBackgroundView = new UIImageView(new UIImage (
new CoreImage.CIImage (UIImage.FromBundle ("login-form-background").ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal))
));
usernameBackgroundView.Frame = new CoreGraphics.CGRect (0, 366, 380, 50);
UITextField tfUsername = new UITextField (new CoreGraphics.CGRect (16, 376, 343, 30));
tfUsername.Font = UIFont.FromName ("Avenir Book", 17);
tfUsername.Alpha = 1;
tfUsername.BackgroundColor = UIColor.Clear;
tfUsername.TextColor = UIColor.White;
tfUsername.Placeholder = "Email or Username";
this.View.Add (usernameBackgroundView);
this.View.Add (tfUsername);
//- Password text box and background
UIImageView passwordBackgroundView = new UIImageView(new UIImage (
new CoreImage.CIImage (UIImage.FromBundle ("login-form-background").ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal))
));
passwordBackgroundView.Frame = new CoreGraphics.CGRect (0, 418, 380, 50);
UITextField tfPassword = new UITextField (
new CoreGraphics.CGRect (16, 428, 343, 30));
tfPassword.Font = UIFont.FromName ("Avenir Book", 17);
tfPassword.Alpha = 1;
tfPassword.BackgroundColor = UIColor.Clear;
tfPassword.TextColor = UIColor.White;
tfPassword.Placeholder = "Password";
this.View.Add (passwordBackgroundView);
this.View.Add (tfPassword);
//- Login Button
UIButton btnLogin = new UIButton(new CoreGraphics.CGRect(59, 479, 256, 49));
btnLogin.Font = UIFont.FromName ("Avenir Book", 22);
btnLogin.BackgroundColor = new UIColor (new CoreGraphics.CGColor (255, 255, 255, 0.85f));
btnLogin.SetTitleShadowColor (UIColor.DarkGray, UIControlState.Normal);
btnLogin.SetTitleColor (UIColor.Red, UIControlState.Normal);
btnLogin.SetTitle ("Login", UIControlState.Normal);
btnLogin.Layer.CornerRadius = 5;
btnLogin.ClipsToBounds = true;
this.View.Add (btnLogin);
//- Forgot password
UIButton btnForgotPassword = new UIButton(new CoreGraphics.CGRect(94,556, 187, 30));
btnForgotPassword.Font = UIFont.FromName ("Avenir Book", 19);
btnForgotPassword.SetTitleColor (UIColor.White, UIControlState.Normal);
btnForgotPassword.SetTitleShadowColor (UIColor.DarkTextColor, UIControlState.Normal);
btnForgotPassword.SetTitle ("Forgot Password?", UIControlState.Normal);
this.View.Add (btnForgotPassword);
//- Facebook login
UIButton btnFacebookLogin = new UIButton(new CoreGraphics.CGRect(73, 623, 228, 32));
btnFacebookLogin.Font = UIFont.FromName ("Avenir Book", 18);
btnFacebookLogin.SetTitle ("Login with Facebook", UIControlState.Normal);
btnFacebookLogin.SetTitleColor (UIColor.White, UIControlState.Normal);
btnFacebookLogin.SetImage (
UIImage.FromBundle ("Facebook-login").ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal),
UIControlState.Normal);
this.View.Add (btnFacebookLogin);
}
示例6: GetButton
UIButton GetButton(CGRect rect, UIImage backImage, string title)
{
var button = new UIButton (rect);
button.SetBackgroundImage (backImage, UIControlState.Normal);
button.SetTitle (title, UIControlState.Normal);
button.SetTitleShadowColor (UIColor.DarkGray, UIControlState.Normal);
button.TitleLabel.ShadowOffset = new CGSize (1, -1);
button.TitleLabel.Font = FoodyTheme.SharedTheme.MainFont;
return button;
}
示例7: ShortProfileView
public ShortProfileView(RectangleF rect, bool discloseButton)
: base(rect)
{
BackgroundColor = UIColor.Clear;
// Pics are 73x73, but we will add a border.
profilePic = new UIImageView (new RectangleF (10, 10, 73, 73));
profilePic.BackgroundColor = UIColor.Clear;
AddSubview (profilePic);
url = UIButton.FromType (UIButtonType.Custom);
url.Font = urlFont;
url.Font = urlFont;
url.LineBreakMode = UILineBreakMode.TailTruncation;
url.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
url.TitleShadowOffset = new SizeF (0, 1);
url.SetTitleColor (UIColor.FromRGB (0x32, 0x4f, 0x85), UIControlState.Normal);
url.SetTitleColor (UIColor.Red, UIControlState.Highlighted);
url.SetTitleShadowColor (UIColor.White, UIControlState.Normal);
url.Frame = new RectangleF (TextX, 70, rect.Width-TextX, urlSize);
AddSubview (url);
if (discloseButton){
var button = UIButton.FromType (UIButtonType.DetailDisclosure);
button.Frame = new RectangleF (290, 36, 20, 20);
AddSubview (button);
button.TouchDown += delegate { Tapped (); };
}
}
示例8: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
var bounds = View.Bounds;
var backgroundColor = new UIColor (0.859f, 0.866f, 0.929f, 1);
View.BackgroundColor = backgroundColor;
//
// Add the bubble chat interface
//
discussionHost = new UIView (new RectangleF (bounds.X, bounds.Y, bounds.Width, bounds.Height-entryHeight)) {
AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth,
AutosizesSubviews = true,
UserInteractionEnabled = true
};
View.AddSubview (discussionHost);
discussionHost.AddSubview (discussion.View);
discussion.View.BackgroundColor = backgroundColor;
//
// Add styled entry
//
chatBar = new UIImageView (new RectangleF (0, bounds.Height-entryHeight, bounds.Width, entryHeight)) {
ClearsContextBeforeDrawing = false,
AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth,
Image = UIImage.FromFile ("ChatBar.png").StretchableImage (18, 20),
UserInteractionEnabled = true
};
View.AddSubview (chatBar);
entry = new UITextView (new RectangleF (10, 9, 234, 22)) {
ContentSize = new SizeF (234, 22),
AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
ScrollEnabled = false,
ScrollIndicatorInsets = new UIEdgeInsets (5, 0, 4, -2),
ClearsContextBeforeDrawing = false,
Font = UIFont.SystemFontOfSize (messageFontSize),
DataDetectorTypes = UIDataDetectorType.All,
BackgroundColor = UIColor.Clear,
};
// Fix a scrolling glitch
entry.ShouldChangeText = (textView, range, text) => {
entry.ContentInset = new UIEdgeInsets (0, 0, 3, 0);
return true;
};
previousContentHeight = entry.ContentSize.Height;
chatBar.AddSubview (entry);
//
// The send button
//
sendButton = UIButton.FromType (UIButtonType.Custom);
sendButton.ClearsContextBeforeDrawing = false;
sendButton.Frame = new RectangleF (chatBar.Frame.Width - 70, 8, 64, 26);
sendButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin;
var sendBackground = UIImage.FromFile ("SendButton.png");
sendButton.SetBackgroundImage (sendBackground, UIControlState.Normal);
sendButton.SetBackgroundImage (sendBackground, UIControlState.Disabled);
sendButton.TitleLabel.Font = UIFont.BoldSystemFontOfSize (16);
sendButton.TitleLabel.ShadowOffset = new SizeF (0, -1);
sendButton.SetTitle ("Send", UIControlState.Normal);
sendButton.SetTitleShadowColor (new UIColor (0.325f, 0.463f, 0.675f, 1), UIControlState.Normal);
sendButton.AddTarget (SendMessage, UIControlEvent.TouchUpInside);
DisableSend ();
chatBar.AddSubview (sendButton);
//
// Listen to keyboard notifications to animate
//
showObserver = UIKeyboard.Notifications.ObserveWillShow (PlaceKeyboard);
hideObserver = UIKeyboard.Notifications.ObserveWillHide (PlaceKeyboard);
ScrollToBottom (false);
// Track changes in the entry to resize the view accordingly
entry.Changed += HandleEntryChanged;
}
示例9: selectTabButton
private void selectTabButton(UIButton button)
{
button.SetTitleColor(UIColor.Red, UIControlState.Normal);
UIImage image = UIImage.FromFile("images/MHTabBarActiveTab.png").StretchableImage(0, 0);
button.SetBackgroundImage(image, UIControlState.Normal);
button.SetBackgroundImage(image, UIControlState.Highlighted);
button.SetTitleColor(UIColor.White, UIControlState.Normal);
button.SetTitleShadowColor(UIColor.FromWhiteAlpha(0.0f, 0.5f), UIControlState.Normal);
}
示例10: deselectTabButton
private void deselectTabButton(UIButton button)
{
button.SetTitleColor(UIColor.Black, UIControlState.Normal);
UIImage image = UIImage.FromFile("images/MHTabBarInactiveTab.png").StretchableImage(1, 0);
button.SetBackgroundImage(image, UIControlState.Normal);
button.SetBackgroundImage(image, UIControlState.Highlighted);
button.SetTitleColor(UIColor.FromRGBA(175/255.0f, 85/255.0f, 58/255.0f, 1.0f), UIControlState.Normal);
button.SetTitleShadowColor(UIColor.White, UIControlState.Normal);
}
示例11: InitSubviews
private void InitSubviews()
{
descriptionLabel = new UILabel (new RectangleF (32, 38, 245, 56)){
Font = UIFont.SystemFontOfSize (17),
TextColor = UIColor.Gray,
BackgroundColor = UIColor.Clear,
Text = "Move the sliders to choose your color",
Lines = 2
};
hueLabel = new UILabel (new RectangleF (32, 190, 198, 21)) {
Font = UIFont.BoldSystemFontOfSize (17),
TextColor = UIColor.Gray,
BackgroundColor = UIColor.Clear,
Text = "Hue"
};
hueValueLabel = new UILabel (new RectangleF (160, 190, 52, 21)) {
Font = UIFont.BoldSystemFontOfSize (17),
TextColor = UIColor.Gray,
BackgroundColor = UIColor.Clear,
Text = "value:"
};
hueNumericValueLabel = new UILabel (new RectangleF (211, 190, 66, 21)) {
Font = UIFont.BoldSystemFontOfSize (17),
TextColor = UIColor.Gray,
TextAlignment = UITextAlignment.Right,
BackgroundColor = UIColor.Clear,
Text = "0.0000",
AdjustsFontSizeToFitWidth = true
};
saturationLabel = new UILabel (new RectangleF (32, 276, 198, 21)) {
Font = UIFont.BoldSystemFontOfSize (17),
TextColor = UIColor.Gray,
BackgroundColor = UIColor.Clear,
Text = "Saturation"
};
saturationValueLabel = new UILabel (new RectangleF (160, 276, 52, 21)) {
Font = UIFont.BoldSystemFontOfSize (17),
TextColor = UIColor.Gray,
BackgroundColor = UIColor.Clear,
Text = "value:"
};
saturationNumericValueLabel = new UILabel (new RectangleF (211, 276, 66, 21)) {
Font = UIFont.BoldSystemFontOfSize (17),
TextColor = UIColor.Gray,
TextAlignment = UITextAlignment.Right,
BackgroundColor = UIColor.Clear,
Text = "1.0000",
AdjustsFontSizeToFitWidth = true
};
colorImageView = new UIImageView (new RectangleF (32, 110, 245, 59)) {
Image = ProlificTheme.SharedTheme.NavigationBackgroundForBarMetrics (UIBarMetrics.Default)
};
button = new UIButton (new RectangleF (32, 363, 245, 37)) {
Font = UIFont.BoldSystemFontOfSize (15),
TitleShadowOffset = new SizeF (0, -1)
};
button.SetTitle ("Done", UIControlState.Normal);
button.SetTitleColor (UIColor.White, UIControlState.Normal);
button.SetTitleShadowColor (UIColor.Gray, UIControlState.Normal);
button.SetBackgroundImage (ProlificTheme.SharedTheme.ButtonBackgroundForState (UIControlState.Normal), UIControlState.Normal);
hueSlider = new UISlider (new RectangleF (30, 224, 249, 23)) {
MinValue = -3.14f,
MaxValue = 3.14f,
Value = 0
};
saturationSlider = new UISlider (new RectangleF (30, 305, 249, 23)) {
MinValue = 0,
MaxValue = 2,
Value = 1
};
// Applies theme styles on specified element
ProlificTheme.Apply (hueSlider);
ProlificTheme.Apply (saturationSlider);
hueSlider.ValueChanged += ColorParametersValueChanged;
saturationSlider.ValueChanged += ColorParametersValueChanged;
button.TouchUpInside += OnDoneTouched;
View.AddSubviews (descriptionLabel, hueLabel, hueValueLabel, hueNumericValueLabel);
View.AddSubviews (saturationLabel, saturationValueLabel, saturationNumericValueLabel);
View.AddSubviews (hueSlider, saturationSlider, colorImageView, button);
}
示例12: ShortProfileView
public ShortProfileView(RectangleF rect, long userId, bool discloseButton)
: base(rect)
{
BackgroundColor = UIColor.Clear;
user = User.FromId (userId);
if (user == null){
Console.WriteLine ("userid={0}", userId);
return;
}
// Pics are 73x73, but we will add a border.
profilePic = new UIImageView (new RectangleF (10, 10, 73, 73));
profilePic.BackgroundColor = UIColor.Clear;
profilePic.Image = ImageStore.RequestProfilePicture (-userId, user.PicUrl, this);
AddSubview (profilePic);
url = UIButton.FromType (UIButtonType.Custom);
url.Font = urlFont;
url.Font = urlFont;
url.LineBreakMode = UILineBreakMode.TailTruncation;
url.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
url.TitleShadowOffset = new SizeF (0, 1);
url.SetTitle (user.Url, UIControlState.Normal);
url.SetTitle (user.Url, UIControlState.Highlighted);
url.SetTitleColor (UIColor.FromRGB (0x32, 0x4f, 0x85), UIControlState.Normal);
url.SetTitleColor (UIColor.Red, UIControlState.Highlighted);
url.SetTitleShadowColor (UIColor.White, UIControlState.Normal);
url.Frame = new RectangleF (TextX, 70, rect.Width-TextX, urlSize);
url.AddTarget (delegate { if (UrlTapped != null) UrlTapped (); }, UIControlEvent.TouchUpInside);
AddSubview (url);
if (discloseButton){
var button = UIButton.FromType (UIButtonType.DetailDisclosure);
button.Frame = new RectangleF (290, 36, 20, 20);
AddSubview (button);
button.TouchDown += delegate { Tapped (); };
}
}