本文整理汇总了C#中UIImage类的典型用法代码示例。如果您正苦于以下问题:C# UIImage类的具体用法?C# UIImage怎么用?C# UIImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIImage类属于命名空间,在下文中一共展示了UIImage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: UpdateCell
public void UpdateCell(string name, string text, UIImage image, DateTime created)
{
imageView.Image = image;
_headingLabel.Text = name;
_subheadingLabel.Text = text;
_createdLable.Text = ParseDate (created);
}
开发者ID:RomanYemelyanenko,项目名称:hashbot,代码行数:7,代码来源:TweetsTableCell.cs
示例2: StringElement
public StringElement (string caption, string value, UIImage image, Action tapped) : base(caption)
{
Tapped += tapped;
this.Value = value;
this.Image = image;
}
开发者ID:goneflyin,项目名称:MonoMobile.Forms,代码行数:7,代码来源:StringElement.cs
示例3: HandleImagePick
private void HandleImagePick(UIImage image, int maxPixelDimension, int percentQuality,
Action<Stream> pictureAvailable, Action assumeCancelled)
{
if (image != null)
{
// resize the image
image = image.ImageToFitSize (new SizeF (maxPixelDimension, maxPixelDimension));
using (NSData data = image.AsJPEG ((float)((float)percentQuality/100.0)))
{
var byteArray = new byte [data.Length];
Marshal.Copy (data.Bytes, byteArray, 0, Convert.ToInt32 (data.Length));
var imageStream = new MemoryStream ();
imageStream.Write (byteArray, 0, Convert.ToInt32 (data.Length));
imageStream.Seek (0, SeekOrigin.Begin);
pictureAvailable (imageStream);
}
}
else
{
assumeCancelled ();
}
_picker.DismissModalViewControllerAnimated(true);
_presenter.NativeModalViewControllerDisappearedOnItsOwn();
}
开发者ID:Gert-Cominotto,项目名称:MvvmCross,代码行数:29,代码来源:MvxImagePickerTask.cs
示例4: GetDefaultImage
/// <summary>
/// Gets the default image.
/// </summary>
/// <returns>The default image.</returns>
private static UIImage GetDefaultImage()
{
if (_defaultImage == null) {
_defaultImage = UIImage.FromFile ("Images/marker-and-shadow.png");
}
return _defaultImage;
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:11,代码来源:MapMarker.cs
示例5: AwakeFromNib
public override void AwakeFromNib ()
{
playBtnBg = UIImage.FromFile ("images/play.png").StretchableImage (12, 0);
pauseBtnBg = UIImage.FromFile ("images/pause.png").StretchableImage (12, 0);
_playButton.SetImage (playBtnBg, UIControlState.Normal);
_duration.AdjustsFontSizeToFitWidth = true;
_currentTime.AdjustsFontSizeToFitWidth = true;
_progressBar.MinValue = 0;
var fileUrl = NSBundle.MainBundle.PathForResource ("sample", "m4a");
player = AVAudioPlayer.FromUrl (new NSUrl (fileUrl, false));
player.FinishedPlaying += delegate(object sender, AVStatusEventArgs e) {
if (!e.Status)
Console.WriteLine ("Did not complete successfully");
player.CurrentTime = 0;
UpdateViewForPlayerState ();
};
player.DecoderError += delegate(object sender, AVErrorEventArgs e) {
Console.WriteLine ("Decoder error: {0}", e.Error.LocalizedDescription);
};
player.BeginInterruption += delegate {
UpdateViewForPlayerState ();
};
player.EndInterruption += delegate {
StartPlayback ();
};
_fileName.Text = String.Format ("Mono {0} ({1} ch)", Path.GetFileName (player.Url.RelativePath), player.NumberOfChannels);
UpdateViewForPlayerInfo ();
UpdateViewForPlayerState ();
}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:33,代码来源:avTouchViewController.cs
示例6: 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
示例7: MenuItem
public MenuItem(UIImage image, UIImage highlightImage)
: base()
{
this.Image = image;
this.HighlightedImage = highlightImage;
this.UserInteractionEnabled = true;
}
开发者ID:sgmunn,项目名称:MonoKit.Controls,代码行数:7,代码来源:MenuItem.cs
示例8: GetCell
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
{
DBError err;
PhotoCell cell = (PhotoCell)collectionView.DequeueReusableCell(PhotoCell.Key, indexPath);
DBPath path = Photos [Photos.Length - indexPath.Row - 1].Path;
DBFile file = DBFilesystem.SharedFilesystem.OpenFile (path, out err);
UIImage image = null;
// This means the file doesn't exist, or it is open with asynchronous operation.
if (file == null) {
cell.Content = null;
return cell;
}
if (file.Status.Cached) {
image = new UIImage (file.ReadData (out err));
file.Close ();
} else {
file.AddObserver (this, () => {
DBFileStatus newStatus = file.NewerStatus;
if ((newStatus == null && file.Status.Cached) ||
(newStatus != null && newStatus.Cached)) {
image = new UIImage (file.ReadData (out err));
cell.Content = image;
file.RemoveObserver(this);
file.Close ();
}
});
}
cell.Content = image;
return cell;
}
开发者ID:WaDAMake,项目名称:CloudPrint,代码行数:35,代码来源:CameraSyncViewController.cs
示例9: FinishedPickingImage
public override void FinishedPickingImage (UIImagePickerController picker, UIImage image, NSDictionary editingInfo)
{
UIApplication.SharedApplication.SetStatusBarHidden(false, false);
var imagePicker = (VCViewController)_navigationController;
if (imagePicker.IsCameraAvailable)
imagePicker.btnBib.Hidden = true;
imagePicker.DismissModalViewControllerAnimated(true);
if (imagePicker.IsCameraAvailable)
{
image.SaveToPhotosAlbum (delegate {
// ignore errors
});
}
UIViewController nextScreen = null;
if (tweet != null)
{
nextScreen = new PhotoPostViewController(_shareNavCont, image, tweet);
}
else
{
nextScreen = new PhotoLocationViewController(_shareNavCont, image);
}
_shareNavCont.PushViewController(nextScreen, true);
}
开发者ID:21Off,项目名称:21Off,代码行数:30,代码来源:pickerDelegate.cs
示例10: UpdateWithData
public void UpdateWithData(Employee employee, UIImage imgDefaultAvatar, UIImage imgPhone, UIImage imgSMS, UIImage imgEmail)
{
avatar.Image = employee.getAvatar ();
if (avatar.Image == null) {
avatar.Image = imgDefaultAvatar;
}
name.Text = employee.getName ();
title.Text = employee.title;
szPhoneNo = employee.getPhoneNo ();
if (szPhoneNo.Length > 0) {
phoneImg.Image = imgPhone;
smsImg.Image = imgSMS;
} else {
}
szEmailAddress = employee.getEmailAddr ();
if (szEmailAddress.Length > 0) {
emailImg.Image = imgEmail;
} else {
}
}
开发者ID:vikewoods,项目名称:KMSDirectoryMono,代码行数:26,代码来源:EmployeeTableViewCell.cs
示例11: AddCustomAnnotation
void AddCustomAnnotation (ShinobiChart chart)
{
// Create an annotation
SChartAnnotationZooming an = new SChartAnnotationZooming {
XAxis = chart.XAxis,
YAxis = chart.YAxis,
// Set its location - using the data coordinate system
XValue = dateFormatter.Parse ("01-01-2009"),
YValue = new NSNumber(250),
// Pin all four corners of the annotation so that it stretches
XValueMax = dateFormatter.Parse ("01-01-2011"),
YValueMax = new NSNumber(550),
// Set bounds
Bounds = new RectangleF (0, 0, 50, 50),
Position = SChartAnnotationPosition.BelowData
};
// Add some custom content to the annotation
UIImage image = new UIImage ("Apple.png");
UIImageView imageView = new UIImageView (image) { Alpha = 0.1f };
an.AddSubview (imageView);
// Add to the chart
chart.AddAnnotation (an);
}
开发者ID:MbProg,项目名称:MasterDetailTestProject-IOS-64,代码行数:28,代码来源:AddingAnnotationsDelegate.cs
示例12: Scale
public static UIImage Scale(UIImage image, float maxWidthAndHeight)
{
//Perform Image manipulation, make the image fit into a 48x48 tile without clipping.
UIImage scaledImage = image;
image.InvokeOnMainThread(() => {
float fWidth = image.Size.Width;
float fHeight = image.Size.Height;
float fTotal = fWidth>=fHeight?fWidth:fHeight;
float fDifPercent = maxWidthAndHeight / fTotal;
float fNewWidth = fWidth*fDifPercent;
float fNewHeight = fHeight*fDifPercent;
SizeF newSize = new SizeF(fNewWidth,fNewHeight);
UIGraphics.BeginImageContext (newSize);
var context = UIGraphics.GetCurrentContext ();
context.TranslateCTM (0, newSize.Height);
context.ScaleCTM (1f, -1f);
context.DrawImage (new RectangleF (0, 0, newSize.Width, newSize.Height), image.CGImage);
scaledImage = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
});
return scaledImage;
}
开发者ID:Redth,项目名称:MonoTouch.UrlImageStore,代码行数:29,代码来源:Graphics.cs
示例13: RoundCorners
public static UIImage RoundCorners (UIImage image, int radius)
{
if (image == null)
throw new ArgumentNullException ("image");
UIImage converted = image;
image.InvokeOnMainThread(() => {
UIGraphics.BeginImageContext (image.Size);
float imgWidth = image.Size.Width;
float imgHeight = image.Size.Height;
var c = UIGraphics.GetCurrentContext ();
c.BeginPath ();
c.MoveTo (imgWidth, imgHeight/2);
c.AddArcToPoint (imgWidth, imgHeight, imgWidth/2, imgHeight, radius);
c.AddArcToPoint (0, imgHeight, 0, imgHeight/2, radius);
c.AddArcToPoint (0, 0, imgWidth/2, 0, radius);
c.AddArcToPoint (imgWidth, 0, imgWidth, imgHeight/2, radius);
c.ClosePath ();
c.Clip ();
image.Draw (new PointF (0, 0));
converted = UIGraphics.GetImageFromCurrentImageContext ();
UIGraphics.EndImageContext ();
});
return converted;
}
开发者ID:Redth,项目名称:MonoTouch.UrlImageStore,代码行数:30,代码来源:Graphics.cs
示例14: FinishedLaunching
// This method is invoked when the application has loaded its UI and its ready to run
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
MonoMobileApplication.NavigationController = new UINavigationController();
_Window = new UIWindow(UIScreen.MainScreen.Bounds);
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
_DefaultImage = UIImage.FromBundle("DefaultiPad.png");
else
_DefaultImage = UIImage.FromBundle("Default.png");
if (_DefaultImage != null)
{
var imageView = new UIImageView(_Window.Bounds);
imageView.Image = _DefaultImage;
_Window.Add(imageView);
_Window.BackgroundColor = UIColor.Clear;
}
MonoMobileApplication.NavigationController.View.Alpha = 0.0f;
_Window.AddSubview(MonoMobileApplication.NavigationController.View);
_Window.MakeKeyAndVisible();
MonoMobileApplication.Window = _Window;
BeginInvokeOnMainThread(()=> { Startup(); });
return true;
}
开发者ID:vknair74,项目名称:MonoMobile.Views,代码行数:31,代码来源:MonoMobileAppDelegate.cs
示例15: CalculateLuminance
private void CalculateLuminance(UIImage d)
{
var imageRef = d.CGImage;
var width = imageRef.Width;
var height = imageRef.Height;
var colorSpace = CGColorSpace.CreateDeviceRGB();
var rawData = Marshal.AllocHGlobal(height * width * 4);
try
{
var flags = CGBitmapFlags.PremultipliedFirst | CGBitmapFlags.ByteOrder32Little;
var context = new CGBitmapContext(rawData, width, height, 8, 4 * width,
colorSpace, (CGImageAlphaInfo)flags);
context.DrawImage(new RectangleF(0.0f, 0.0f, (float)width, (float)height), imageRef);
var pixelData = new byte[height * width * 4];
Marshal.Copy(rawData, pixelData, 0, pixelData.Length);
CalculateLuminance(pixelData, BitmapFormat.BGRA32);
}
finally
{
Marshal.FreeHGlobal(rawData);
}
}
开发者ID:Woo-Long,项目名称:ZXing.Net.Mobile,代码行数:26,代码来源:RGBLuminanceSource.monotouch.cs
示例16: ItemView
public ItemView(Item item)
{
this.item = item;
AddSubview (button = new UIButton {
ContentMode = UIViewContentMode.ScaleAspectFill,
Layer = {
ShadowColor = UIColor.Black.CGColor,
ShadowRadius = .3f,
ShadowOpacity = .3f,
ShadowOffset = new SizeF (1f, 1),
},
});
button.TouchUpInside += (object sender, EventArgs e) => onTap ();
button.SetImage (image = ImageLoader.Load (item.Image).ImageWithRenderingMode (UIImageRenderingMode.AlwaysTemplate), UIControlState.Normal);
label = new UILabel {
AdjustsFontSizeToFitWidth = true,
Font = UIFont.BoldSystemFontOfSize (100),
TextAlignment = UITextAlignment.Center,
Text = "0",
Layer = {
ShadowColor = UIColor.Black.CGColor,
ShadowOpacity = .25f,
ShadowRadius = .3f,
ShadowOffset = new SizeF (1f, 1),
}
};
xScale = (float)random.NextDouble ();
yScale = (float)random.NextDouble ();
var s = Math.Max (random.NextDouble (), .5);
scale = (float)Math.Min (s, .9);
}
开发者ID:nagyist,项目名称:ToddlerAddition,代码行数:32,代码来源:ItemView.cs
示例17: UIInbox
public UIInbox()
{
var script = this.RenderScript("messageinbox.uis");
Background = new UIImage(backgroundImage);
this.AddAt(0, Background);
CloseButton.OnButtonClick += new ButtonClickDelegate(Close);
UIUtils.MakeDraggable(Background, this);
MessageButton.OnButtonClick += new ButtonClickDelegate(MessageButton_OnButtonClick);
var msgStyleCSR = script.Create<UIListBoxTextStyle>("CSRMessageColors", InboxListBox.FontStyle);
var msgStyleServer = script.Create<UIListBoxTextStyle>("ServerMessageColors", InboxListBox.FontStyle);
var msgStyleGame = script.Create<UIListBoxTextStyle>("GameMessageColors", InboxListBox.FontStyle);
var msgStyleSim = script.Create<UIListBoxTextStyle>("SimMessageColors", InboxListBox.FontStyle);
var msgStyleClub = script.Create<UIListBoxTextStyle>("ClubMessageColors", InboxListBox.FontStyle);
var msgStyleProperty = script.Create<UIListBoxTextStyle>("PropertyMessageColors", InboxListBox.FontStyle);
var msgStyleNeighborhood = script.Create<UIListBoxTextStyle>("NeighborhoodMessageColors", InboxListBox.FontStyle);
var item = new UIListBoxItem("idk", "!", "", "||", "", "21:21 - 4/2/2014", "", "The Sims Online", "", "Please stop remaking our game");
item.CustomStyle = msgStyleSim;
InboxListBox.Items.Add(item);
Dropdown = new UIInboxDropdown();
Dropdown.X = 162;
Dropdown.Y = 13;
this.Add(Dropdown);
}
开发者ID:ddfczm,项目名称:Project-Dollhouse,代码行数:28,代码来源:UIInbox.cs
示例18: UICitySelector
public UICitySelector()
: base(UIDialogStyle.Standard, true)
{
this.Opacity = 0.9f;
CityListBoxBackground = new UIImage(UITextBox.StandardBackground);
this.Add(CityListBoxBackground);
CityDescriptionBackground = new UIImage(UITextBox.StandardBackground);
this.Add(CityDescriptionBackground);
var script = this.RenderScript("cityselector.uis");
this.DialogSize = (Point)script.GetControlProperty("DialogSize");
var cityThumbBG = new UIImage(thumbnailBackgroundImage);
cityThumbBG.Position = (Vector2)script.GetControlProperty("CityThumbnailBackgroundPosition");
this.Add(cityThumbBG);
CityThumb = new UIImage();
CityThumb.Position = (Vector2)script.GetControlProperty("CityThumbnailPosition");
this.Add(CityThumb);
CityDescriptionSlider.AttachButtons(CityDescriptionScrollUpButton, CityDescriptionDownButton, 1);
DescriptionText.AttachSlider(CityDescriptionSlider);
OkButton.Disabled = true;
OkButton.OnButtonClick += new ButtonClickDelegate(OkButton_OnButtonClick);
CancelButton.OnButtonClick += new ButtonClickDelegate(CancelButton_OnButtonClick);
this.Caption = (string)script["TitleString"];
/** Parse the list styles **/
var listStyleNormal = script.Create<UIListBoxTextStyle>("CityListBoxColors", CityListBox.FontStyle);
var listStyleBusy = script.Create<UIListBoxTextStyle>("CityListBoxColorsBusy", CityListBox.FontStyle);
var listStyleFull = script.Create<UIListBoxTextStyle>("CityListBoxColorsFull", CityListBox.FontStyle);
var listStyleReserved = script.Create<UIListBoxTextStyle>("CityListBoxColorsReserved", CityListBox.FontStyle);
var statusToStyle = new Dictionary<CityInfoStatus, UIListBoxTextStyle>();
statusToStyle.Add(CityInfoStatus.Ok, listStyleNormal);
statusToStyle.Add(CityInfoStatus.Busy, listStyleBusy);
statusToStyle.Add(CityInfoStatus.Full, listStyleFull);
statusToStyle.Add(CityInfoStatus.Reserved, listStyleReserved);
var statusToLabel = new Dictionary<CityInfoStatus, string>();
statusToLabel.Add(CityInfoStatus.Ok, StatusOk);
statusToLabel.Add(CityInfoStatus.Busy, StatusBusy);
statusToLabel.Add(CityInfoStatus.Full, StatusFull);
statusToLabel.Add(CityInfoStatus.Reserved, StatusOk);
CityListBox.TextStyle = listStyleNormal;
CityListBox.Items =
NetworkFacade.Cities.Select(
x => new UIListBoxItem(x, CityIconImage, x.Name, x.Online ? OnlineStatusUp : OnlineStatusDown, statusToLabel[x.Status])
{
//Disabled = x.Status != TSOServiceClient.Model.CityInfoStatus.Ok,
CustomStyle = statusToStyle[x.Status]
}
).ToList();
CityListBox.OnChange += new ChangeDelegate(CityListBox_OnChange);
//CityListBox.SelectedIndex = 0;
}
开发者ID:Tranquill6,项目名称:Project-Dollhouse,代码行数:60,代码来源:UICitySelector.cs
示例19: ViewDidLoad
public override void ViewDidLoad ()
{
var ok = new UIImage("Images/Icons/icon_checked.png");
var notOk = new UIImage("Images/Icons/icon_unchecked.png");
imgArt.Image = _logg.ArtId > 0 ? ok : notOk;
imgJeger.Image = _logg.JegerId > 0 ? ok : notOk;
imgNotater.Image = _logg.Notes.Length > 0 ? ok : notOk;
imgPosisjon.Image = _logg.Latitude.Length > 0 ? ok : notOk;
imgSkudd.Image = _logg.Skudd > 0 ? ok : notOk;
imgBilde.Image = _logg.ImagePath.Length > 0 ? ok : notOk;
var imgstr = Utils.GetPath("jaktlogg_"+_logg.ID+".jpg");
if(!File.Exists(imgstr)){
imgstr = "Images/Icons/pictureplaceholder.png";
buttonImage.SetImage(new UIImage(imgstr), UIControlState.Normal);
}
else
buttonImage.SetImage(new UIImage(Utils.GetPath(imgstr)), UIControlState.Normal);
buttonImage.Layer.MasksToBounds = true;
buttonImage.Layer.CornerRadius = 5.0f;
buttonImage.TouchUpInside += HandleButtonImageTouchUpInside;
base.ViewDidLoad ();
}
开发者ID:TheGiant,项目名称:Jaktloggen,代码行数:26,代码来源:HeaderLoggItem.xib.cs
示例20: SetStretchableImage
public static void SetStretchableImage(this UIImageView view, string imagePath)
{
var normalImage = new UIImage (imagePath);
var stretchableNormalImage = UIImage.FromBundle (imagePath).StretchableImage((int) (normalImage.Size.Width/2 - 1),
(int)(normalImage.Size.Height/2 - 1));
view.Image = stretchableNormalImage;
}
开发者ID:RomanYemelyanenko,项目名称:hashbot,代码行数:7,代码来源:Extension.cs
注:本文中的UIImage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论