当前位置: 首页>>代码示例>>C#>>正文


C# UIButton.SetBackgroundImage方法代码示例

本文整理汇总了C#中UIButton.SetBackgroundImage方法的典型用法代码示例。如果您正苦于以下问题:C# UIButton.SetBackgroundImage方法的具体用法?C# UIButton.SetBackgroundImage怎么用?C# UIButton.SetBackgroundImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIButton的用法示例。


在下文中一共展示了UIButton.SetBackgroundImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GoogleButton

 public static void GoogleButton (UIButton v)
 {
     v.Font = UIFont.FromName ("HelveticaNeue-Light", 16f);
     v.SetBackgroundImage (UIColor.Clear.ToImage (), UIControlState.Normal);
     v.SetBackgroundImage (UIColor.FromWhiteAlpha (0f, 0.3f).ToImage (), UIControlState.Highlighted);
     v.SetTitleColor (Color.Gray, UIControlState.Normal);
 }
开发者ID:nagyist,项目名称:toggl-mobile,代码行数:7,代码来源:Style.Signup.cs

示例2: ClientButton

 public static void ClientButton (UIButton v)
 {
     v.SetBackgroundImage (Color.White.ToImage (), UIControlState.Normal);
     v.SetBackgroundImage (Color.LightestGray.ToImage (), UIControlState.Highlighted);
     v.ContentEdgeInsets = new UIEdgeInsets (0, 15f, 0, 15f);
     v.Font = UIFont.FromName ("HelveticaNeue-Light", 17f);
     v.HorizontalAlignment = UIControlContentHorizontalAlignment.Fill;
 }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:8,代码来源:Style.NewProject.cs

示例3: SetupNavigationBar

		void SetupNavigationBar ()
		{
			BackingBackButton = new UIButton (new RectangleF (0, 0, 25, 25));
			BackingBackButton.SetBackgroundImage (UIImage.FromFile (Images.BackButton), UIControlState.Normal);
			BackingBackButton.SetBackgroundImage (UIImage.FromFile (Images.BackButtonHighlighted), UIControlState.Highlighted);

			BackButton = new UIBarButtonItem (BackingBackButton);
			NavigationItem.LeftBarButtonItem = BackButton;
		}
开发者ID:pierceboggan,项目名称:Verses,代码行数:9,代码来源:CopyrightViewController.cs

示例4: SetupNavigationBar

        private void SetupNavigationBar()
        {
            var backButton = new UIButton (new RectangleF (0, 0, 25, 25));
            backButton.SetBackgroundImage (UIImage.FromFile (Images.BackButton), UIControlState.Normal);
            backButton.SetBackgroundImage (UIImage.FromFile (Images.BackButtonHighlighted), UIControlState.Highlighted);
            backButton.AddTarget(HandleBackButtonTapped, UIControlEvent.TouchUpInside);

            backNavigationButton = new UIBarButtonItem (backButton);
            NavigationItem.LeftBarButtonItem = backNavigationButton;
        }
开发者ID:pierceboggan,项目名称:Verses,代码行数:10,代码来源:WebViewController.cs

示例5: AddButton

 private void AddButton(string imageName, float leftBound)
 {
     var button = new UIButton (UIButtonType.Custom);
     button.Frame = new RectangleF (leftBound, 320, 95, 54);
     button.ImageEdgeInsets = new UIEdgeInsets (-12, 0, 0, 0);
     button.SetImage (UIImage.FromFile ("Info/icon_" + imageName + ".png"), UIControlState.Normal);
     button.SetBackgroundImage (UIImage.FromFile ("Info/button.png").CreateResizableImage (new UIEdgeInsets (0, 10, 0, 10)), UIControlState.Normal);
     button.SetBackgroundImage (UIImage.FromFile ("Info/button_pressed.png").CreateResizableImage (new UIEdgeInsets (0, 10, 0, 10)), UIControlState.Highlighted);
     AddSubview (button);
 }
开发者ID:seva-ask,项目名称:iOStests,代码行数:10,代码来源:InfoView.cs

示例6: StopButton

 public static void StopButton (UIButton v)
 {
     v.Font = UIFont.FromName ("HelveticaNeue-Light", 16f);
     v.SetBackgroundImage (Image.CircleStop, UIControlState.Normal);
     v.SetBackgroundImage (Image.CircleStopPressed, UIControlState.Highlighted);
     v.SetTitleColor (Color.Red, UIControlState.Normal);
     v.SetTitleColor (Color.White, UIControlState.Highlighted);
     v.SetTitle ("NavTimerStop".Tr (), UIControlState.Normal);
     // TODO: Remove this scale workaround
     v.Transform = MonoTouch.CoreGraphics.CGAffineTransform.MakeScale (0.7f, 0.7f);
 }
开发者ID:jblj,项目名称:mobile,代码行数:11,代码来源:Style.NavTimer.cs

示例7: SetupNavigationBar

		private void SetupNavigationBar ()
		{
			backingCancelButton = new UIButton (new RectangleF (0, 0, 25, 25));
			backingCancelButton.SetBackgroundImage (UIImage.FromFile (Images.CancelButton), UIControlState.Normal);
			backingCancelButton.SetBackgroundImage (UIImage.FromFile (Images.CancelButtonHighlighted), UIControlState.Highlighted);

			backingSaveButton = new UIButton (new RectangleF (0, 0, 25, 25));
			backingSaveButton.SetBackgroundImage (UIImage.FromFile (Images.SaveButton), UIControlState.Normal);
			backingSaveButton.SetBackgroundImage (UIImage.FromFile (Images.SaveButtonHighlighted), UIControlState.Highlighted);

			cancelButton = new UIBarButtonItem (backingCancelButton);
			saveButton = new UIBarButtonItem (backingSaveButton);

			NavigationItem.LeftBarButtonItem = cancelButton;
			NavigationItem.RightBarButtonItem = saveButton;
		}
开发者ID:pierceboggan,项目名称:Verses,代码行数:16,代码来源:VerseComposeDialog.cs

示例8: LoadNa

        public static void LoadNa(UIViewController mainview, string titlestr)
        {
            mainview.View.BackgroundColor = UIColor.FromRGB(240, 240, 240);

            UIImageView imageView = new UIImageView(NABACKIMAGE);

            UILabel titleLable = new UILabel(new RectangleF(110, 0, 100, 44));
            titleLable.Text = titlestr;
            titleLable.BackgroundColor = UIColor.Clear;
            titleLable.TextAlignment = UITextAlignment.Center;
            titleLable.TextColor = UIColor.FromRGB(255, 255, 255);
            titleLable.Font = UIFont.FromName(FONTFAMILY, 16f);

            UIButton backButton = new UIButton(new RectangleF(0, 0, 44, 44));
            backButton.SetBackgroundImage(NABARBACKIMAGE, UIControlState.Normal);
            backButton.BackgroundColor = UIColor.Clear;
            backButton.TouchUpInside += (sender, e) =>
            {
                mainview.NavigationController.PopViewControllerAnimated(true);
            };

            UIButton closeButton = new UIButton(new RectangleF(276, 0, 44, 44));
            closeButton.SetBackgroundImage(NABARCLOSEIMAGE, UIControlState.Normal);
            closeButton.BackgroundColor = UIColor.Clear;

            mainview.NavigationController.NavigationBar.Add(imageView);
            mainview.NavigationController.NavigationBar.Add(titleLable);
            mainview.NavigationController.NavigationBar.Add(backButton);
            mainview.NavigationController.NavigationBar.Add(closeButton);
        }
开发者ID:dkme,项目名称:moooyo,代码行数:30,代码来源:LoadNavigation.cs

示例9: RowSelected

        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            var webViewController = new UIViewController ();
            var button = new UIBarButtonItem ("Back", UIBarButtonItemStyle.Plain, null);

            var custom = new UIButton (new RectangleF (0, 0, 26, 15));
            custom.SetBackgroundImage(UIImage.FromFile("./Assets/back.png"), UIControlState.Normal);
            custom.TouchUpInside += (sender, e) => webViewController.NavigationController.PopViewControllerAnimated (true);
            button.CustomView = custom;
            webViewController.NavigationItem.LeftBarButtonItem = button;

            var spinner = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
            spinner.Center = new PointF (160, 160);
            spinner.HidesWhenStopped = true;

            var webView = new UIWebView (tableView.Bounds);
            webView.Opaque = false;
            webView.BackgroundColor = UIColor.Black;
            webView.AddSubview (spinner);
            spinner.StartAnimating ();
            webView.LoadRequest (new NSUrlRequest (new NSUrl (string.Format(RequestConfig.Video, items[indexPath.Row].Id))));
            webViewController.View = webView;
            webViewController.Title = items[indexPath.Row].Category;
            webView.LoadFinished += (object sender, EventArgs e) => {
                spinner.StopAnimating();
            };

            ((MainTabController)UIApplication.SharedApplication.Delegate.Window.RootViewController).
                Video.InternalTopNavigation.PushViewController (webViewController,true);

            tableView.DeselectRow (indexPath, true);
        }
开发者ID:jgrozdanov,项目名称:mono-sport,代码行数:32,代码来源:VideoControllerSource.cs

示例10: ViewWillAppear

        public override void ViewWillAppear(bool animated)
        {
            this.ScrollableArea.Frame= ((AppDelegate)UIApplication.SharedApplication.Delegate).Window.Frame;
            this.ScrollableArea.ContentSize=new SizeF (320, 600);

            if (((AppDelegate)UIApplication.SharedApplication.Delegate).profilePhoto == null) {
                this.Image.Image = UIImage.FromFile ("./Assets/profilebig.png");
            } else {
                this.Image.Image = ((AppDelegate)UIApplication.SharedApplication.Delegate).profilePhoto;
            }

            this.MakeProfilePublic.SetBackgroundImage(UIImage.FromFile ("./Assets/settings-unchecked.png"), UIControlState.Normal);
            this.Chose.SetBackgroundImage(UIImage.FromFile ("./Assets/choose.png"), UIControlState.Normal);
            this.Divider.Image = UIImage.FromFile("./Assets/divider.png");
            this.SecondDivider.Image = UIImage.FromFile ("./Assets/divider.png");

            var button = new UIBarButtonItem ("Back", UIBarButtonItemStyle.Plain, null);
            var custom = new UIButton (new RectangleF (0, 0, 26, 15));
            custom.SetBackgroundImage(UIImage.FromFile("./Assets/back.png"), UIControlState.Normal);
            custom.TouchUpInside += (sender, e) => NavigationController.PopViewControllerAnimated (true);
            button.CustomView = custom;

            this.NavigationItem.LeftBarButtonItem = button;
            this.NavigationController.SetNavigationBarHidden (false, false);
        }
开发者ID:jgrozdanov,项目名称:mono-sport,代码行数:25,代码来源:EditProfileController.cs

示例11: SetupUserInterface

		void SetupUserInterface ()
		{
			var centerButtonX = View.Bounds.GetMidX () - 35f;
			var topLeftX = View.Bounds.X + 25;
			var topRightX = View.Bounds.Right - 65;
			var bottomButtonY = View.Bounds.Bottom - 150;
			var topButtonY = View.Bounds.Top + 15;
			var buttonWidth = 70;
			var buttonHeight = 70;

			liveCameraStream = new UIView () {
				Frame = new CGRect (0f, 0f, 320f, View.Bounds.Height)
			};

			takePhotoButton = new UIButton () {
				Frame = new CGRect (centerButtonX, bottomButtonY, buttonWidth, buttonHeight)
			};
			takePhotoButton.SetBackgroundImage (UIImage.FromFile ("TakePhotoButton.png"), UIControlState.Normal);

			toggleCameraButton = new UIButton () {
				Frame = new CGRect (topRightX, topButtonY + 5, 35, 26)
			};
			toggleCameraButton.SetBackgroundImage (UIImage.FromFile ("ToggleCameraButton.png"), UIControlState.Normal);

			toggleFlashButton = new UIButton () {
				Frame = new CGRect (topLeftX, topButtonY, 37, 37)
			};
			toggleFlashButton.SetBackgroundImage (UIImage.FromFile ("NoFlashButton.png"), UIControlState.Normal);

			View.Add (liveCameraStream);
			View.Add (takePhotoButton);
			View.Add (toggleCameraButton);
			View.Add (toggleFlashButton);
		}
开发者ID:ChandrakanthBCK,项目名称:xamarin-forms-samples,代码行数:34,代码来源:CameraPageRenderer.cs

示例12: LayoutSubviews

        public override void LayoutSubviews()
        {
            base.LayoutSubviews();
            var cameraFound = false;

            if (UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.Camera))
            {
                cameraFound = true;

                var button = new UIButton(UIButtonType.Custom);
                button.Frame = new CoreGraphics.CGRect(Frame.Width - 44, 9, 28, 21);
                button.SetBackgroundImage(UIImage.FromFile("Barcode.png"), UIControlState.Normal);
                button.TouchUpInside += (sender, e) =>
                {
                    button.PulseToSize(0.7f, 0.3, false);
                    Clicked();
                };
                Subviews[0].AddSubview(button);
            }                      

            foreach(var view in Subviews[0].Subviews)
            {
                if (cameraFound && view.GetType() == typeof(UITextField))
                    view.Frame = new CoreGraphics.CGRect(6, 5, view.Frame.Width - 44, 30);

                var textfield = Subviews[0].Subviews[1] as UITextField;
                if (textfield != null)
                    textfield.Font = UIFont.FromName("Avenir-Book", 14);
            };

        }
开发者ID:vkoppaka,项目名称:BeerDrinkin,代码行数:31,代码来源:SearchBar.cs

示例13: ViewDidLoad

        public override void ViewDidLoad() {
            base.ViewDidLoad();
            View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
            View.BackgroundColor = UIColor.White;

            var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty"),
                                                filledImage: UIImage.FromBundle("Stars/filled"),
                                                chosenImage: UIImage.FromBundle("Stars/chosen"));
            // [Optional] Put a little space between the rating items.
            ratingConfig.ItemPadding = 5f;
            backgroundButton = UIButton.FromType(UIButtonType.RoundedRect);
            backgroundButton.SetBackgroundImage(UIImage.FromBundle("Background/background").StretchableImage(0, 0), UIControlState.Normal);
            backgroundButton.Frame = new CGRect(new CGPoint(24f, 24f), new CGSize(View.Bounds.Width - (2f * 24f), 125f));

            var ratingFrame = backgroundButton.Bounds;

            ratingView = new PDRatingView(ratingFrame, ratingConfig);

            // [Optional] Set the current rating to display.
            decimal rating = 3.58m;
            //decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m;
            //decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero);
            ratingView.AverageRating = rating;

            // [Optional] Make it read-only to keep the user from setting a rating.
            //StarRating.UserInteractionEnabled = false;

            // [Optional] Attach to the rating event to do something with the chosen value.
            ratingView.RatingChosen += (sender, e) => {
                (new UIAlertView("Rated!", e.Rating.ToString() + " stars", null, "Ok")).Show();
            };

            backgroundButton.Add(ratingView);
            View.Add(backgroundButton);
        }
开发者ID:xmendoza,项目名称:BeerDrinkin,代码行数:35,代码来源:CustomBackgroundViewController.cs

示例14: TextButton

        public TextButton(IntPtr handle)
            : base(handle)
        {
            icon = UIButton.FromType (UIButtonType.Custom);
            icon.Frame = new CGRect (Spacing, Spacing, IconBackgroundSize, IconBackgroundSize);
            icon.UserInteractionEnabled = false;
            AddSubview (icon);

            TopLabel = new UILabel {
                BackgroundColor = UIColor.Clear,
                Font = Theme.BoldFontOfSize (11f),
                TextColor = Theme.LabelColor,
                HighlightedTextColor = UIColor.Black
            };
            AddSubview (TopLabel);

            BottomLabel = new UILabel {
                BackgroundColor = UIColor.Clear,
                Font = Theme.FontOfSize (11f),
                TextColor = Theme.LabelColor,
                HighlightedTextColor = UIColor.Black
            };
            AddSubview (BottomLabel);

            if (!Theme.IsiOS7)
                icon.SetBackgroundImage (Theme.SmallGreyButton, UIControlState.Normal);
        }
开发者ID:tranuydu,项目名称:prebuilt-apps,代码行数:27,代码来源:TextButton.cs

示例15: SetBgImageFor

 public static void SetBgImageFor(string imagePath, UIButton button, UIControlState state)
 {
     using (UIImage img = UIImage.FromFile(imagePath)) {
         Assert.NotNull(img);
         button.SetBackgroundImage(img, state);
     }
 }
开发者ID:rzaitov,项目名称:RottenTomatoes,代码行数:7,代码来源:ImageInitializer.cs


注:本文中的UIButton.SetBackgroundImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。