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


C# UIImageView类代码示例

本文整理汇总了C#中UIImageView的典型用法代码示例。如果您正苦于以下问题:C# UIImageView类的具体用法?C# UIImageView怎么用?C# UIImageView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Into

        /// <summary>
        /// Loads the image into given imageView using defined parameters.
        /// </summary>
        /// <param name="parameters">Parameters for loading the image.</param>
        /// <param name="imageView">Image view that should receive the image.</param>
        /// <param name="imageScale">Optional scale factor to use when interpreting the image data. If unspecified it will use the device scale (ie: Retina = 2, non retina = 1)</param>
        public static IScheduledWork Into(this TaskParameter parameters, UIImageView imageView, float imageScale = -1f)
        {
            var weakRef = new WeakReference<UIImageView>(imageView);
            Func<UIImageView> getNativeControl = () => {
                UIImageView refView;
                if (!weakRef.TryGetTarget(out refView))
                    return null;
                return refView;
            };

			Action<UIImage, bool> doWithImage = (img, fromCache) => {
                UIImageView refView = getNativeControl();
                if (refView == null)
                    return;

				var isFadeAnimationEnabled = parameters.FadeAnimationEnabled.HasValue ? 
					parameters.FadeAnimationEnabled.Value : ImageService.Config.FadeAnimationEnabled;

				if (isFadeAnimationEnabled && !fromCache)
				{
					// fade animation
					UIView.Transition(refView, 0.4f, 
						UIViewAnimationOptions.TransitionCrossDissolve 
						| UIViewAnimationOptions.BeginFromCurrentState,
						() => { refView.Image = img; },
						() => {  });
				}
				else
				{
					refView.Image = img;
				}
            };

            return parameters.Into(getNativeControl, doWithImage, imageScale);
        }
开发者ID:nukedbit,项目名称:FFImageLoading,代码行数:41,代码来源:TaskParameterExtensions.cs

示例2: 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;
		}
开发者ID:jonburn,项目名称:xamarin-store-app,代码行数:33,代码来源:ProductListViewController.cs

示例3: Cell

 public Cell()
 {
     ImageView = new UIImageView(RectangleF.Empty);
     ImageView.ContentMode = UIViewContentMode.ScaleToFill;
     this.AddSubview(ImageView);
     BackgroundColor = UIColor.White;
 }
开发者ID:GSerjo,项目名称:appreciateui,代码行数:7,代码来源:Cell.cs

示例4: ProvisioningDialog

        public ProvisioningDialog()
            : base(UITableViewStyle.Grouped, null)
        {
            Root = new RootElement ("GhostPractice Mobile");
            var topSec = new Section ("Welcome");
            topSec.Add (new StringElement ("Please enter activation code"));
            activation = new EntryElement ("Code", "Activation Code", "999998-zcrdbrkqwogh");
            topSec.Add (activation);
            var submit = new StringElement ("Send Code");
            submit.Alignment = UITextAlignment.Center;

            submit.Tapped += delegate {
                if (activation.Value == null || activation.Value == string.Empty) {
                    new UIAlertView ("Device Activation", "Please enter activation code", null, "OK", null).Show ();
                    return;
                }
                if (!isBusy) {
                    getAsyncAppAndPlatform ();
                } else {
                    Wait ();
                }

            };
            topSec.Add (submit);
            Root.Add (topSec);

            UIImage img = UIImage.FromFile ("Images/launch_small.png");
            UIImageView v = new UIImageView (new RectangleF (0, 0, 480, 600));
            v.Image = img;
            Root.Add (new Section (v));
        }
开发者ID:rajeshwarn,项目名称:GhostPractice-iPadRepo,代码行数:31,代码来源:ProvisioningDialog.cs

示例5: SessionCell

		const int buttonSpace = 45; //24;
		
		public SessionCell (UITableViewCellStyle style, NSString ident, Session showSession, string big, string small) : base (style, ident)
		{
			SelectionStyle = UITableViewCellSelectionStyle.Blue;
			
			titleLabel = new UILabel () {
				TextAlignment = UITextAlignment.Left,
				BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
			};
			speakerLabel = new UILabel () {
				TextAlignment = UITextAlignment.Left,
				Font = smallFont,
				TextColor = UIColor.DarkGray,
				BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
			};
			locationImageView = new UIImageView();
			locationImageView.Image = building;

			button = UIButton.FromType (UIButtonType.Custom);
			button.TouchDown += delegate {
				UpdateImage (ToggleFavorite ());
				if (AppDelegate.IsPad) {
					NSObject o = new NSObject();
					NSDictionary progInfo = NSDictionary.FromObjectAndKey(o, new NSString("FavUpdate"));

					NSNotificationCenter.DefaultCenter.PostNotificationName(
						"NotificationFavoriteUpdated", o, progInfo);
				}
			};
			UpdateCell (showSession, big, small);
			
			ContentView.Add (titleLabel);
			ContentView.Add (speakerLabel);
			ContentView.Add (button);
			ContentView.Add (locationImageView);
		}
开发者ID:topcbl,项目名称:mobile-samples,代码行数:37,代码来源:SessionCell.cs

示例6: 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);
        }
开发者ID:WinterGroveProductions,项目名称:monotouch-bindings,代码行数:29,代码来源:ControlsViewController.cs

示例7: AssignmentCell

		public AssignmentCell (IntPtr handle) : base (handle)
		{
			assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel>();

			if (!Theme.IsiOS7)
				SelectedBackgroundView = new UIImageView { Image = Theme.AssignmentBlue };
		}
开发者ID:felipecembranelli,项目名称:MyXamarinSamples,代码行数:7,代码来源:AssignmentCell.cs

示例8: ADVPopoverProgressBar

		public ADVPopoverProgressBar(RectangleF frame, ADVProgressBarColor barColor): base(frame)
		{
			bgImageView = new UIImageView(new RectangleF(0, 0, frame.Width, 24));
			
			bgImageView.Image = UIImage.FromFile("progress-track.png");
			this.AddSubview(bgImageView);
			
			progressFillImage = UIImage.FromFile("progress-fill.png").CreateResizableImage(new UIEdgeInsets(0, 20, 0, 40));
			progressImageView = new UIImageView(new RectangleF(-2, 0, 0, 32));
			this.AddSubview(progressImageView);
			
			percentView = new UIView(new RectangleF(5, 4, PERCENT_VIEW_WIDTH, 15));
			percentView.Hidden = true;
			
			UILabel percentLabel = new UILabel(new RectangleF(0, 0, PERCENT_VIEW_WIDTH, 14));
			percentLabel.Tag = 1;
			percentLabel.Text = "0%";
			percentLabel.BackgroundColor = UIColor.Clear;
			percentLabel.TextColor = UIColor.Black;
			percentLabel.Font = UIFont.BoldSystemFontOfSize(11);
			percentLabel.TextAlignment = UITextAlignment.Center;
			percentLabel.AdjustsFontSizeToFitWidth = true;
			percentView.AddSubview(percentLabel);
			
			this.AddSubview(percentView);
		}
开发者ID:MbProg,项目名称:MasterDetailTestProject-IOS-64,代码行数:26,代码来源:ADVPopoverProgressBar.cs

示例9: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			Title = "Images";

			// a simple image
			var img = UIImage.FromBundle ("Images/Icons/50_icon.png");
			imageView = new UIImageView (img) {
				Frame = new CGRect (20, 20, img.CGImage.Width, img.CGImage.Height)
			};
			View.AddSubview (imageView);

			// an animating image
			imgSpinningCircle = new UIImageView {
				Frame = new CGRect (150, 20, 100, 100),
				AnimationRepeatCount = 0,
				AnimationDuration = .5,
				AnimationImages = new UIImage[] {
					UIImage.FromBundle ("Images/Spinning Circle_1.png"),
					UIImage.FromBundle ("Images/Spinning Circle_2.png"),
					UIImage.FromBundle ("Images/Spinning Circle_3.png"),
					UIImage.FromBundle ("Images/Spinning Circle_4.png")
				}
			};

			View.AddSubview (imgSpinningCircle);
			imgSpinningCircle.StartAnimating ();
		}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:29,代码来源:Images2_iPhone.xib.cs

示例10: ViewDidAppear

        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear (animated);

             foreach (var view in View.Subviews)
             {
            view.RemoveFromSuperview ();
            view.Dispose ();
             }

             var bytes = Convert.FromBase64String (_encodedImage);
             var imageData = NSData.FromArray (bytes);

             var image = UIImage.LoadFromData (imageData);
             switch (_type)
             {
            case ImageClarityType.Default:
               break;
            case ImageClarityType.ExtraSaturation:
               image = image.ApplyFilter (0.5f, 2, 2f);
               break;
            case ImageClarityType.ExtraContrast:
               image = image.ApplyFilter (0.5f, 0, 4);
               break;
            case ImageClarityType.ExtraBrightness:
               image = image.ApplyFilter (0.5f, 0.1f, 2);
               break;
             }

             _previewImageView = new UIImageView (new CGRect (new CGPoint (0, 0), image.ScreenSize ())) {
            ContentMode = UIViewContentMode.ScaleAspectFit,
            Image = image
             };
             View.AddSubviews (_previewImageView);
        }
开发者ID:bkmza,项目名称:XamCropBkmzaSampleIOS,代码行数:35,代码来源:BTabPreviewViewController.cs

示例11: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			// Set the Image inside the ImageView
			var imgView = new UIImageView (UIImage.FromBundle ("leaf.jpg")) {
				ContentMode = UIViewContentMode.Center
			};

			// Set the scrollpad content size so it has plenty of room to scroll (Image Size)
			scrollPad.ContentSize = imgView.Bounds.Size;
			scrollPad.AddSubview (imgView);

			// Subscribe to normal event handler so when ScrollView is Decelerating
			// this will be called
			scrollPad.DraggingEnded += (object sender, DraggingEventArgs e) => {
				if (e.Decelerate == true) {
					Console.WriteLine ("Dragging ended, Decelerate:{0}", e.Decelerate);
					InvokeOnMainThread (() => lblStatus.Text = "Try Again.");
				}
			};

			// The Rx fun starts here, we will look at DraggingEnded event and look inside its DraggingEventArgs
			// to see if Decelerate == false, so only then we will "React" to the event.
			ScrollReactSource = Observable.FromEventPattern<DraggingEventArgs> (scrollPad, "DraggingEnded")
				.Where (ev => ev.EventArgs.Decelerate == false)
				.ToEventPattern ();

			ReactOnDecelerate += (sender, ev) => 
				InvokeOnMainThread (() => {                
					lblStatus.Text = "Cool you did it!! Rx Working!";
					Console.WriteLine ("Dragging ended from Rx, Decelerate:false");
				});

		}
开发者ID:ThePublicBikeGang,项目名称:EasyBike,代码行数:35,代码来源:iOSRxSampleViewController.cs

示例12: ViewDidLoad

		public override void ViewDidLoad()
		{
			base.ViewDidLoad();
			Title = "Choose Photo";
			View.BackgroundColor = UIColor.White;

			imageView = new UIImageView(new CGRect(10, 150, 300, 300));
			Add(imageView);

			choosePhotoButton = UIButton.FromType(UIButtonType.RoundedRect);
			choosePhotoButton.Frame = new CGRect(10, 80, 100, 40);
			choosePhotoButton.SetTitle("Picker", UIControlState.Normal);
			choosePhotoButton.TouchUpInside += (s, e) => {
				// create a new picker controller
				imagePicker = new UIImagePickerController();
				
				// set our source to the photo library
				imagePicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
								
				// set what media types
				imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary);
				
				imagePicker.FinishedPickingMedia += Handle_FinishedPickingMedia;
				imagePicker.Canceled += Handle_Canceled;
				
				// show the picker
				NavigationController.PresentModalViewController(imagePicker, true);
				//UIPopoverController picc = new UIPopoverController(imagePicker);

			};
			View.Add(choosePhotoButton);
		}
开发者ID:StargrrlMoonlight,项目名称:recipes,代码行数:32,代码来源:ImageViewController.cs

示例13: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
         if (AppDelegate.iOS7Plus)
            EdgesForExtendedLayout = UIRectEdge.None;

         /*
            MCvFont font = new MCvFont(
                Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_PLAIN,
                1.0,
                1.0
            );*/

         using (Image<Bgr, Byte> image = new Image<Bgr, Byte>(320, 240))
         {
            image.SetValue(new Bgr(255, 255, 255));
            image.Draw(
               "Hello, world",
               new Point(30, 30),
               CvEnum.FontFace.HersheyPlain,
               1.0,
               new Bgr(0, 255, 0)
            );

            UIImageView imageView = new UIImageView(image.ToUIImage());
            Add(imageView);
         }
        }
开发者ID:DAmatheson,项目名称:emgucv,代码行数:28,代码来源:HelloWorldUIViewController.cs

示例14: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            scrollView = new UIScrollView (
                new RectangleF (0, 0, View.Frame.Width,
                    View.Frame.Height));
            View.AddSubview (scrollView);

            imageView = new UIImageView (UIImage.FromBundle ("heinz-map.png"));

            scrollView.ContentSize = imageView.Image.Size;
            scrollView.AddSubview (imageView);
            scrollView.MaximumZoomScale = 0.7f;
            scrollView.MinimumZoomScale = 0.4f;
            scrollView.ContentOffset = new PointF (0, 500);
            scrollView.ZoomScale = 5f;
            scrollView.ViewForZoomingInScrollView += (UIScrollView svm) => {
                return imageView;
            };

            UITapGestureRecognizer doubletap =  new UITapGestureRecognizer(OnDoubleTap) {
                NumberOfTapsRequired = 2 // double tap
            };
            scrollView.AddGestureRecognizer(doubletap);
        }
开发者ID:cdmedia,项目名称:heinzight,代码行数:26,代码来源:MapViewController.cs

示例15: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			// iOS7: Keep content from hiding under navigation bar.
			if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
				EdgesForExtendedLayout = UIRectEdge.None;
			}

			Title = speaker.Name;
			View.BackgroundColor = UIColor.White;

			name = new UILabel (new RectangleF(10, 10, 200, 30));
			name.Font = UIFont.BoldSystemFontOfSize (20f);
			company = new UILabel (new RectangleF( 10, 40, 200, 30));
			avatar = new UIImageView (new RectangleF (230, 10, 75, 75));

			View.Add (name);
			View.Add (company);
			View.Add (avatar);

			name.Text = speaker.Name;
			company.Text = speaker.Company;
			avatar.Image = UIImage.FromBundle (speaker.HeadshotUrl);
		}
开发者ID:flolovebit,项目名称:xamarin-evolve-2014,代码行数:25,代码来源:SpeakerViewController.cs


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