本文整理汇总了C#中UIImageView.AddSubview方法的典型用法代码示例。如果您正苦于以下问题:C# UIImageView.AddSubview方法的具体用法?C# UIImageView.AddSubview怎么用?C# UIImageView.AddSubview使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIImageView
的用法示例。
在下文中一共展示了UIImageView.AddSubview方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: Draw
public override void Draw (RectangleF rect)
{
if (_overlayImageView != null)
{
//Util.Log ("Drawing blended image with overlay alpha " + _overlayImageView.Alpha);
UIImage bottomImage = _underlayImageView.Image;
UIImage topImage = _overlayImageView.Image;
UIImageView imageView = new UIImageView(bottomImage);
UIImageView subView = new UIImageView(topImage);
bottomImage.Dispose();
topImage.Dispose();
subView.Alpha = _overlayImageView.Alpha;
imageView.AddSubview(subView);
UIGraphics.BeginImageContext(imageView.Frame.Size);
imageView.Layer.RenderInContext(UIGraphics.GetCurrentContext());
UIImage blendedImage = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
subView.Dispose();
imageView.Dispose();
blendedImage.Draw(rect);
blendedImage.Dispose();
}
else
{
// Draw nothing
}
}
示例3: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
_database = AppDelegate.SessionDatabase;
_dates = _database.GetDates().ToList();
UIImageView imageView = new UIImageView(UIImage.FromFile("BackgroundMonospace.png"));
imageView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height);
imageView.UserInteractionEnabled = true;
// no XIB !
tableView = new UITableView()
{
Delegate = new TableViewDelegate(this, _dates),
DataSource = new TableViewDataSource(this, _dates),
AutoresizingMask = UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.Clear,
Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height),
};
// Set the table view to fit the width of the app.
//tableView.SizeToFit();
// Reposition and resize the receiver
//tableView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height);
// Add the table view as a subview
//this.View.AddSubview(tableView);
imageView.AddSubview(tableView);
this.View.AddSubview(imageView);
}
示例4: ViewDidLoad
/// <summary>
///
/// </summary>
/// <remarks>
/// Background image idea from
/// http://mikebluestein.wordpress.com/2009/10/05/setting-an-image-background-on-a-uitableview-using-monotouch/
/// </remarks>
public override void ViewDidLoad()
{
base.ViewDidLoad ();
_database = AppDelegate.SessionDatabase;
_speakers = _database.GetSpeakers().ToList();
UIImageView imageView = new UIImageView(UIImage.FromFile("BackgroundMonospace.png"));
imageView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height);
imageView.UserInteractionEnabled = true;
// no XIB !
tableView = new UITableView()
{
Delegate = new TableViewDelegate(this, _speakers),
DataSource = new TableViewDataSource(_speakers),
AutoresizingMask = UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.Clear,
Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height-100)
};
imageView.AddSubview(tableView);
this.View.AddSubview(imageView);
}
示例5: ViewDidLoad
/// <remarks>
/// Background image idea from
/// http://mikebluestein.wordpress.com/2009/10/05/setting-an-image-background-on-a-uitableview-using-monotouch/
/// </remarks>
public override void ViewDidLoad()
{
base.ViewDidLoad ();
Title = "Speakers";
//_speakerData = AppDelegate.ConferenceData.Speakers;
speakerData = MonkeySpace.Core.ConferenceManager.Speakers.Values.ToList ();
UIImageView imageView = new UIImageView (UIImage.FromFile ("Background.png"));
imageView.Frame = new RectangleF (0, 0, View.Frame.Width, View.Frame.Height);
imageView.UserInteractionEnabled = true;
tableView = new UITableView { Source = new TableViewSource (this, speakerData)
, AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth
, BackgroundColor = UIColor.Clear
, Frame = new RectangleF (0, 0, View.Frame.Width, View.Frame.Height - 44)
, ShowsVerticalScrollIndicator = true};
imageView.AddSubview (tableView);
View.AddSubview (imageView);
// SLIDEOUT BUTTON
NavigationController.NavigationBar.SetTitleTextAttributes(AppDelegate.Current.FontTitleTextAttributes);
var bbi = new UIBarButtonItem(UIImage.FromBundle ("Images/slideout"), UIBarButtonItemStyle.Plain, (sender, e) => {
AppDelegate.Current.FlyoutNavigation.ToggleMenu();
});
NavigationItem.SetLeftBarButtonItem (bbi, false);
tableView.BackgroundView = new UIImageView (UIImage.FromBundle ("Images/Background"));
}
示例6: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
_days = AppDelegate.ConferenceData.Days;
UIImageView imageView = new UIImageView(UIImage.FromFile("Background.png"));
imageView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height);
imageView.UserInteractionEnabled = true;
// no XIB !
tableView = new UITableView()
{
Source = new TableViewSource(this, _days),
AutoresizingMask = UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.Clear,
Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height),
};
// Set the table view to fit the width of the app.
tableView.SizeToFit();
// Reposition and resize the receiver
tableView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height);
// Add the table view as a subview
this.View.AddSubview(tableView);
imageView.AddSubview(tableView);
this.View.AddSubview(imageView);
}
示例7: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
UIImageView imageView = new UIImageView (UIImage.FromFile ("Background.png"));
imageView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height);
imageView.UserInteractionEnabled = true;
// no XIB !
tableView = new UITableView { Source = new TableViewSource (this, _date, _slots), AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth, BackgroundColor = UIColor.Clear, Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height - 100) };
imageView.AddSubview (tableView);
this.View.AddSubview (imageView);
}
示例8: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Wireup Show button
ShowButton.TouchUpInside += (sender, e) => {
// Create a UIImage view to show in the popover
UIImageView monkeyIcon = new UIImageView(new CGRect(0,0,256,256));
monkeyIcon.Image = UIImage.FromFile("MonkeyIcon.png");
monkeyIcon.UserInteractionEnabled = true;
// Create a view controller to act as the popover
UIViewController popover = new UIViewController();
popover.View = monkeyIcon;
popover.ModalPresentationStyle = UIModalPresentationStyle.Popover;
// Grab Image
var image = UIImage.FromFile("298-circlex.png");
// Add a close button
var closeButton = new ImageButton(new CGRect(popover.View.Frame.Size.Width,20,image.Size.Width,image.Size.Height));
closeButton.UserInteractionEnabled = true;
closeButton.Image = image;
monkeyIcon.AddSubview(closeButton);
// Wireup the close button
closeButton.Touched += (button) => {
popover.DismissViewController(true,null);
};
// Present the popover
PresentViewController(popover,true,null);
// Configure the popover for the iPad, the popover displays as a modal view on the
// iPhone
UIPopoverPresentationController presentationPopover = popover.PopoverPresentationController;
if (presentationPopover!=null) {
presentationPopover.SourceView = this.View;
presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
presentationPopover.SourceRect = ShowButton.Frame;
}
};
}
示例9: ViewDidLoad
/// <remarks>
/// Background image idea from
/// http://mikebluestein.wordpress.com/2009/10/05/setting-an-image-background-on-a-uitableview-using-monotouch/
/// </remarks>
public override void ViewDidLoad()
{
base.ViewDidLoad ();
//_speakerData = AppDelegate.ConferenceData.Speakers;
speakerData = MonkeySpace.Core.ConferenceManager.Speakers.Values.ToList ();
UIImageView imageView = new UIImageView (UIImage.FromFile ("Background.png"));
imageView.Frame = new RectangleF (0, 0, View.Frame.Width, View.Frame.Height);
imageView.UserInteractionEnabled = true;
tableView = new UITableView { Source = new TableViewSource (this, speakerData)
, AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth
, BackgroundColor = UIColor.Clear
, Frame = new RectangleF (0, 0, View.Frame.Width, View.Frame.Height - 93)
, ShowsVerticalScrollIndicator = true};
imageView.AddSubview (tableView);
View.AddSubview (imageView);
}
示例10: BuildOutputView
/// <summary>
/// Builds the output view.
/// </summary>
/// <returns>The output view.</returns>
/// <param name="n">N.</param>
UIImageView BuildOutputView (int n)
{
// Create a new image view controller
var imageView = new UIImageView (new CGRect (CameraView.Frame.Width * n, 0, CameraView.Frame.Width, CameraView.Frame.Height));
// Load a temp image
imageView.Image = UIImage.FromFile ("[email protected]");
// Add a label
var label = new UILabel (new CGRect (0, 20, CameraView.Frame.Width, 24));
label.TextColor = UIColor.White;
label.Text = string.Format ("Bracketed Image {0}", n);
imageView.AddSubview (label);
// Add to scrolling view
ScrollView.AddSubview (imageView);
// Return new image view
return imageView;
}
示例11: FinishedLaunching
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
_waitingView = new WaitingView();
subscribeToMessages();
CodeCampService = new CodeCampService("http://codecamps.gregshackles.com/v1", "nyccodecamp6");
_tabController = new TabController();
_tabController.View.BackgroundColor = UIColor.Clear;
var backgroundImage = new UIImageView(UIImage.FromFile("Content/Images/background.png"));
backgroundImage.UserInteractionEnabled = true;
backgroundImage.Frame = new System.Drawing.RectangleF(0, 0, window.Frame.Width, window.Frame.Height);
backgroundImage.AddSubview(_tabController.View);
window.AddSubview(backgroundImage);
window.MakeKeyAndVisible ();
return true;
}
示例12: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
if (_timeslot > 0)
{ // filter by timeslot
Sessions = AppDelegate.ConferenceData.Sessions.Take(4).ToList();
}
else if (!String.IsNullOrEmpty(_tag))
{ // filter by tag
var x = from s in AppDelegate.ConferenceData.Sessions
where s.HasTag(_tag)
select s;
Sessions = x.ToList();
}
else
{ // just show all
Sessions = AppDelegate.ConferenceData.Sessions;
}
FavoriteCodes = AppDelegate.UserData.GetFavoriteCodes();
UIImageView imageView = new UIImageView(UIImage.FromFile("Background.png"));
imageView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height);
imageView.UserInteractionEnabled = true;
// no XIB !
tableView = new UITableView()
{
Source = new TableViewSource(this),
AutoresizingMask = UIViewAutoresizing.FlexibleHeight|
UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.Clear,
Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height-100)
};
imageView.AddSubview(tableView);
this.View.AddSubview(imageView);
didViewDidLoadJustRun = true;
}
示例13: ViewForItemAtIndex
public override UIView ViewForItemAtIndex(iCarousel carousel, uint index, UIView view)
{
//create new view if no view is available for recycling
if (view == null) {
var v = new UIImageView (new RectangleF (0f, 0f, 200.0f, 200.0f));
v.Image = UIImage.FromBundle ("page.png");
v.ContentMode = UIViewContentMode.Center;
var l = new UILabel (v.Bounds);
l.BackgroundColor = UIColor.Clear;
l.TextAlignment = UITextAlignment.Center;
l.Font = l.Font.WithSize (50f);
l.Tag = 1;
l.Text = owner.items [(int)index].ToString ();
v.AddSubview (l);
return v;
}
var label = (UILabel)view.ViewWithTag (1);
label.Text = owner.items [(int)index].ToString ();
return view;
}
示例14: PlaceholderViewAtIndex
public override UIView PlaceholderViewAtIndex(iCarousel carousel, uint index, UIView view)
{
UILabel label = null;
UIImageView imageView = null;
//create new view if no view is available for recycling
if (null == view) {
//don't do anything specific to the index within
//this `if (view == nil) {...}` statement because the view will be
//recycled and used with other index values later
imageView = new UIImageView (new RectangleF (0f, 0f, 200.0f, 200.0f));
imageView.Image = UIImage.FromBundle ("page.png");
imageView.ContentMode = UIViewContentMode.Center;
label = new UILabel (imageView.Bounds);
label.BackgroundColor = UIColor.Clear;
label.TextAlignment = UITextAlignment.Center;
label.Font = label.Font.WithSize (50f);
label.Tag = 1;
imageView.AddSubview (label);
} else {
label = (UILabel)view.ViewWithTag (1);
imageView = (UIImageView)view;
}
//set item label
//remember to always set any properties of your carousel item
//views outside of the `if (view == nil) {...}` check otherwise
//you'll get weird issues with carousel item content appearing
//in the wrong place in the carousel
label.Text = (index == 0) ? "[" : "]";
return imageView;
}
示例15: TableViewCellForRowAtIndexPath
UITableViewCell TableViewCellForRowAtIndexPath(UITableView aTableView, NSIndexPath indexPath)
{
UITableViewCell cell;
cell = aTableView.DequeueReusableCell ("MenuCell");
if (indexPath.Section == 0) {
cell.BackgroundColor = UIColor.Clear;
UIImageView imgRow = (UIImageView)cell.ViewWithTag (1);
imgRow.Image = UIImage.FromFile ("Images/Common/user_1.png");
UILabel lblText = (UILabel)cell.ViewWithTag (2);
lblText.Text = "Virgil Pana";
} else {
cell.BackgroundColor = UIColor.Clear;
MenuItem item = dataSource.items [indexPath.Row];
UIImageView imgRow = (UIImageView)cell.ViewWithTag (1);
imgRow.Image = item.Image;
UILabel lblText = (UILabel)cell.ViewWithTag (2);
lblText.Text = item.Name;
UIView countView = null;
if (item.EventCount > 0) {
string countString = item.EventCount.ToString ();
#if __UNIFIED__
SizeF sizeCount = UIStringDrawing.StringSize (countString, UIFont.SystemFontOfSize (14.0f));
#else
SizeF sizeCount = View.StringSize (countString, UIFont.SystemFontOfSize (14.0f));
#endif
UIImage bkgImg = UIImage.FromFile ("Images/iPhone/sidemenu-count.png");
countView = new UIImageView (bkgImg.StretchableImage(12, 0));
#if __UNIFIED__
countView.Frame =
new RectangleF (0, 0, (float)sizeCount.Width + 2 * 10, (float)bkgImg.Size.Height)
//.Inegral()
;
UILabel lblCount =
new UILabel
(
new RectangleF(10, (float)(bkgImg.Size.Height-sizeCount.Height)/2-2, (float) sizeCount.Width, (float) sizeCount.Height)
);
#else
countView.Frame =
new RectangleF (0, 0, (float)sizeCount.Width + 2 * 10, (float)bkgImg.Size.Height)
.Integral ()
;
UILabel lblCount =
new UILabel
(
new RectangleF(10, (float)(bkgImg.Size.Height-sizeCount.Height)/2-2, sizeCount.Width, sizeCount.Height)
.Integral()
);
#endif
lblCount.Text = countString;
lblCount.BackgroundColor = UIColor.Clear;
lblCount.TextColor = UIColor.White;
lblCount.TextAlignment = UITextAlignment.Center;
lblCount.Font = UIFont.SystemFontOfSize (14.0f);
lblCount.ShadowColor = UIColor.Black;
lblCount.ShadowOffset = new SizeF (0, 1);
countView.AddSubview (lblCount);
}
cell.AccessoryView = countView;
}
return cell;
}