本文整理汇总了C#中UIImageView类的典型用法代码示例。如果您正苦于以下问题:C# UIImageView类的具体用法?C# UIImageView怎么用?C# UIImageView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIImageView类属于命名空间,在下文中一共展示了UIImageView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = session.Title;
background = new UIImageView (UIImage.FromBundle ("images/Background"));
View.Add (background);
View.SendSubviewToBack (background);
title = new UILabel (new RectangleF(10, 74, 320, 30));
title.Font = UIFont.FromName("Avenir-Medium", 20.0f );
title.BackgroundColor = UIColor.Clear;
speaker = new UILabel (new RectangleF( 10, 104, 320, 30));
speaker.Font = UIFont.FromName("Avenir-Light", 14.0f );
speaker.BackgroundColor = UIColor.Clear;
room = new UILabel (new RectangleF( 10, 134, 320, 30));
room.Font = UIFont.FromName("Avenir-Light", 14.0f );
room.TextColor = UIColor.DarkGray;
room.BackgroundColor = UIColor.Clear;
favorite = new UIImageView (new RectangleF (270, 104, 38, 38));
favorite.Image = UIImage.FromBundle ("images/favorited");
View.Add (title);
View.Add (speaker);
View.Add (room);
View.Add (favorite);
title.Text = session.Title;
speaker.Text = session.Speaker;
room.Text = session.Location;
}
开发者ID:CodeMangler,项目名称:XamarinUniversity,代码行数:34,代码来源:SessionViewController.cs
示例17: NativeiOSListViewCell
public NativeiOSListViewCell(NSString cellId)
: base(UITableViewCellStyle.Default, cellId)
{
SelectionStyle = UITableViewCellSelectionStyle.Gray;
ContentView.BackgroundColor = UIColor.FromRGB(218, 255, 127);
imageView = new UIImageView();
headingLabel = new UILabel()
{
Font = UIFont.FromName("Cochin-BoldItalic", 22f),
TextColor = UIColor.FromRGB(127, 51, 0),
BackgroundColor = UIColor.Clear
};
subHeadingLabel = new UILabel()
{
Font = UIFont.FromName("AmericanTypewriter", 12f),
TextColor = UIColor.FromRGB(38, 127, 0),
TextAlignment = UITextAlignment.Center,
BackgroundColor = UIColor.Clear
};
ContentView.Add(headingLabel);
ContentView.Add(subHeadingLabel);
ContentView.Add(imageView);
}
开发者ID:ArtemKumeisha,项目名称:MyXamarin,代码行数:28,代码来源:NativeiOSListViewCell.cs
示例18: MenuItem
public MenuItem(UIImage image, UIImage highlightImage, UIImage contentImage, UIImage highlightContentImage)
: base()
{
this.Image = image;
this.HighlightedImage = highlightImage;
this.UserInteractionEnabled = true;
// figure this out
if (contentImage == null)
{
contentImage = image;
}
if (contentImage != null)
{
this.contentImageView = new UIImageView(contentImage);
if (highlightContentImage != null)
{
this.contentImageView.HighlightedImage = highlightContentImage;
}
this.AddSubview(this.contentImageView);
}
}
开发者ID:sgmunn,项目名称:MonoKit.Controls,代码行数:25,代码来源:MenuItem.cs
示例19: AwakeFromNib
public override void AwakeFromNib()
{
base.AwakeFromNib ();
if (!Theme.IsiOS7) {
BackgroundView = new UIImageView { Image = Theme.Inlay };
photoFrame.Image = Theme.PhotoFrame;
return;
}
SelectionStyle = UITableViewCellSelectionStyle.Blue;
SelectedBackgroundView = new UIView { BackgroundColor = UIColor.Clear };
BackgroundView = new UIView { BackgroundColor = Theme.BackgroundColor };
date.TextColor =
description.TextColor = Theme.LabelColor;
date.Font = Theme.FontOfSize (18);
description.Font = Theme.FontOfSize (14);
//Change the image frame
var frame = photoFrame.Frame;
frame.Y = 0;
frame.Height = Frame.Height;
frame.Width -= 12;
photo.Frame = frame;
//Changes to widths on text
frame = date.Frame;
frame.Width -= 15;
date.Frame = frame;
frame = description.Frame;
frame.Width -= 15;
description.Frame = frame;
}
开发者ID:tranuydu,项目名称:prebuilt-apps,代码行数:35,代码来源:PhotoCell.cs
示例20: GetCell
public override UITableViewCell GetCell(UITableView tv)
{
var cell = tv.DequeueReusableCell(ckey);
if (cell == null)
{
cell = new UITableViewCell(UITableViewCellStyle.Subtitle, ckey);
cell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
}
cell.TextLabel.Text = detailImageData.Title;
cell.DetailTextLabel.Text = detailImageData.SubTitle;
cell.DetailTextLabel.LineBreakMode = UILineBreakMode.WordWrap;
cell.DetailTextLabel.Lines = 2;
// to show an image on the right instead of the left. Just set the accessory view to that of a UIImageView.
if (cell.AccessoryView == null)
{
var img = ImageLoader.DefaultRequestImage(detailImageData.ImageUri, this);
if (img != null)
{
var imgView = new UIImageView(img);
imgView.Frame = new RectangleF(0,0,75,65);
cell.AccessoryView = imgView;
}
}
return cell;
}
开发者ID:josiahpeters,项目名称:CCBoise,代码行数:29,代码来源:DetailedImageElement.cs
注:本文中的UIImageView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论