本文整理汇总了C#中UIImageView.RemoveFromSuperview方法的典型用法代码示例。如果您正苦于以下问题:C# UIImageView.RemoveFromSuperview方法的具体用法?C# UIImageView.RemoveFromSuperview怎么用?C# UIImageView.RemoveFromSuperview使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIImageView
的用法示例。
在下文中一共展示了UIImageView.RemoveFromSuperview方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleLongPressGesture
protected override void HandleLongPressGesture()
{
switch (LongPressGestureRecognizer.State)
{
case UIGestureRecognizerState.Began:
{
// we get the current item and draw a floating copy on it on the Collection View, so that it cannot be taken outside the bounds of the collection view
// we get the copy usign RasterizedImage
var currentIndexPath = CollectionView.IndexPathForItemAtPoint(LongPressGestureRecognizer.LocationInView(CollectionView));
SelectedItemIndexPath = currentIndexPath;
if (SelectedItemIndexPath == null)
return;
if (!DataSource.CanMoveItemAtIndexPath(SelectedItemIndexPath))
return;
var collectionViewCell = CollectionView.CellForItem(SelectedItemIndexPath);
CurrentView = new UIView(collectionViewCell.Frame);
collectionViewCell.Highlighted = true;
var highlightedImageView = new UIImageView(RastertizedImage(collectionViewCell));
highlightedImageView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
highlightedImageView.Alpha = 1.0f;
collectionViewCell.Highlighted = false;
var imageView = new UIImageView(RastertizedImage(collectionViewCell));
imageView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
imageView.Alpha = 0.0f;
CurrentView.AddSubview(imageView);
CurrentView.AddSubview(highlightedImageView);
CollectionView.AddSubview(CurrentView);
CurrentViewCenter = CurrentView.Center;
OnWillBeginDraggingItem(SelectedItemIndexPath);
// animate the floating copy into existence
UIView.Animate(0.3, 0.0, UIViewAnimationOptions.BeginFromCurrentState,
() =>
{
CurrentView.Transform = CGAffineTransform.MakeScale(1.1f, 1.1f);
highlightedImageView.Alpha = 0.0f;
imageView.Alpha = 1.0f;
},
() =>
{
highlightedImageView.RemoveFromSuperview();
OnDidBegingDraggingItem(SelectedItemIndexPath);
});
InvalidateLayout();
}
break;
case UIGestureRecognizerState.Cancelled:
case UIGestureRecognizerState.Ended:
{
var currentIndexPath = SelectedItemIndexPath;
if (currentIndexPath == null)
return;
SelectedItemIndexPath = null;
CurrentViewCenter = PointF.Empty;
OnWillEndDraggingItem(currentIndexPath);
UIView.Animate(0.3, 0.0, UIViewAnimationOptions.BeginFromCurrentState,
() =>
{
var layoutAttributes = LayoutAttributesForItem(currentIndexPath);
CurrentView.Transform = CGAffineTransform.MakeScale(1.0f, 1.0f);
CurrentView.Center = layoutAttributes.Center;
},
() =>
{
CurrentView.RemoveFromSuperview();
CurrentView = null;
InvalidateLayout();
OnDidEndDraggingItem(currentIndexPath);
});
}
break;
}
}
示例2: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
AppDelegate.NavigationBar.SetBackButtonOn(this);
// Initialize the alternate list selector
_listView = new SeriesListViewController(this);
_listView.View.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
_listView.View.Frame = new RectangleF(0, 0, View.Frame.Width, View.Frame.Height);
// Initialize the art gallery (already in background)
_galleryView = new SeriesGalleryViewController(this, _listView);
_galleryView.View.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
_galleryView.View.Frame = new RectangleF(0, 0, View.Frame.Width, View.Frame.Height);
// http://stackoverflow.com/questions/1718495/why-does-viewdidappear-not-get-triggered
this.View.AddSubview(AppGlobal.CollectionsViewInListMode ? _listView.View : _galleryView.View);
// http://www.grokkingcocoa.com/a-simple-way-to-animate-a-u.html
// http://ykyuen.wordpress.com/2010/06/11/iphone-adding-image-to-uibarbuttonitem/
var listViewImage = UIImage.FromBundle("Images/gallery/listView.png");
var listViewImageHighlighted = UIImage.FromBundle("Images/gallery/listViewHighlighted.png");
_buttonFrame = new RectangleF(0, 0, 29, 30);
_buttonListThumb = new UIImageView(listViewImage);
listViewImage.Dispose();
_buttonListThumb.Frame = _buttonFrame;
_buttonListThumb.Hidden = AppGlobal.CollectionsViewInListMode;
var buttonListHighlight = new UIImageView(listViewImageHighlighted);
listViewImageHighlighted.Dispose();
buttonListHighlight.Frame = _buttonFrame;
// Build a thumbnail button for the selected page's piece
// TODO duplicate with code to select a piece in the list view
// TODO shouldn't have to size something from a factory method!
var thumb0 = ImageFactory.LoadRoundedThumbnail(_series.Pieces[_page]);
var thumb1 = ImageHelper.ImageToFitSize(thumb0, _listViewImageSize);
thumb0.Dispose();
_buttonGalleryThumb = new UIImageView(thumb1);
thumb1.Dispose();
_buttonGalleryThumb.Hidden = !AppGlobal.CollectionsViewInListMode;
_buttonGalleryThumb.Frame = _buttonFrame;
// Wire up the flip button
_buttonInner = UIButton.FromType(UIButtonType.Custom);
_buttonInner.UserInteractionEnabled = true;
_buttonInner.Bounds = _buttonListThumb.Bounds;
_buttonInner.AddSubview(_buttonListThumb);
_buttonInner.AddSubview(_buttonGalleryThumb);
_buttonInner.AddTarget(delegate {
_buttonInner.InsertSubviewAbove(_buttonListThumb, buttonListHighlight);
buttonListHighlight.RemoveFromSuperview();
Flip();
}, UIControlEvent.TouchUpInside);
_buttonInner.AddTarget(delegate {
_buttonInner.InsertSubviewAbove(_buttonListThumb, buttonListHighlight);
buttonListHighlight.RemoveFromSuperview();
Flip();
}, UIControlEvent.TouchUpOutside);
_buttonInner.AddTarget(delegate {
_buttonInner.InsertSubviewAbove(buttonListHighlight, _buttonListThumb);
_buttonListThumb.RemoveFromSuperview();
}, UIControlEvent.TouchDown);
// Wire up the series info button
var info = UIButton.FromType(UIButtonType.InfoLight);
info.UserInteractionEnabled = true;
info.AddTarget((s, a)=> { ShowSeriesDetails(); }, UIControlEvent.TouchUpInside);
_infoButton = new UIBarButtonItem(info);
_listButton = new UIBarButtonItem(_buttonInner);
LayoutBarButtonItems();
}
示例3: ViewWillAppear
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear (animated);
_imageView = new UIImageView(new RectangleF(0, 0, 320, 480 - 54));
_imageView.BackgroundColor = UIColor.Gray;
_imageView.Image = UIImage.FromBundle("Images/BarCodeOverlay.png");
Add(_imageView);
_imageView.Image.Dispose();
//The iris - we don't want that one
NSTimer timer = NSTimer.CreateScheduledTimer(new TimeSpan(0, 0, 2),delegate
{
_imageView.RemoveFromSuperview();
this.OverlayView.StartWorker();
});
// NSNotificationCenter.DefaultCenter.AddObserver(new NSString("PLCameraViewIrisAnimationDidEndNotification"), (notification) => {
//
// if(this.View != null)
// {
// _imageView.RemoveFromSuperview();
//
// this.OverlayView.StartWorker();
// }
// });
}
示例4: RightViewPushViewControllerOverCenterController
public void RightViewPushViewControllerOverCenterController(UIViewController controller)
{
Debug.Assert(this.CenterController.GetType().IsSubclassOf(typeof(UINavigationController)), "cannot rightViewPushViewControllerOverCenterView when center controller is not a navigation controller");
UIGraphics.BeginImageContextWithOptions(this.View.Bounds.Size, true, 0);
CGContext context = UIGraphics.GetCurrentContext();
this.View.Layer.RenderInContext(context);
UIImage deckshot = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
UIImageView shotView = new UIImageView(deckshot);
shotView.Frame = this.View.Frame;
this.View.Superview.AddSubview(shotView);
CGRect targetFrame = this.View.Frame;
this.View.Frame = RectangleFOffset(this.View.Frame, this.View.Frame.Size.Width, 0);
this.CloseRightView(true);
UINavigationController navController = ((UINavigationController)this.CenterController);
navController.PushViewController(controller, false);
UIView.Animate(0.3, 0, UIViewAnimationOptions.TransitionNone, () =>
{
shotView.Frame = RectangleFOffset(shotView.Frame, -this.View.Frame.Size.Width, 0);
this.View.Frame = targetFrame;
},
() =>
{
shotView.RemoveFromSuperview();
});
}
示例5: OnRequestPhotoViewer
private void OnRequestPhotoViewer (BaseContentCardViewModel viewModel)
{
var index = ViewModel.CardViewModels.IndexOf (viewModel);
var cell = _tableController.TableView.CellAt (NSIndexPath.FromRowSection (index, 0)) as DefaultCell;
var startFrame = cell.ConvertRectToView (cell.ImageRect, View);
var imageView = new UIImageView (startFrame);
imageView.ContentMode = UIViewContentMode.ScaleAspectFill;
imageView.Image = cell.Image;
cell.ImageHidden = true;
View.AddSubview (imageView);
_fullScreenView = new UIViewFullscreen ();
_fullScreenView.WillHide += (object sender, EventArgs e) => {
imageView.Hidden = false;
// Scale the image back to the cell
UIView.AnimateNotify(_fullScreenView.AnimationDuration/2, () => {
imageView.Frame = startFrame;
}, (isComplete) => {
imageView.RemoveFromSuperview();
imageView = null;
cell.ImageHidden = false;
});
};
_fullScreenView.SetImage(cell.Image);
_fullScreenView.Show();
// Set final Rect Animation
var finalFrame = _fullScreenView.ConvertRectToView(_fullScreenView.ImageFrame, View);
UIView.AnimateNotify (_fullScreenView.AnimationDuration/2, () => {
imageView.Frame = finalFrame;
}, async (isComplete) => {
await Task.Delay(500);
imageView.Hidden = true;
});
}
示例6: HandleScanResult
void HandleScanResult(ZXing.Result result)
{
string msg = "";
if (result != null && !string.IsNullOrEmpty (result.Text)) {
msg = "Found Barcode: " + result.Text;
UIImage captureImage = result.CaptureImage as UIImage;
if (captureImage != null) {
InvokeOnMainThread (() => {
nfloat height = 300 * (captureImage.Size.Height / captureImage.Size.Width);
CGRect theRect = new CGRect(new CGPoint(10,0), new CGSize(300,height));
UIImageView theView = new UIImageView(theRect);
theView.ContentMode = UIViewContentMode.ScaleToFill;
this.View.AddSubview(theView);
UIGraphics.BeginImageContext(captureImage.Size);
captureImage.Draw(CGPoint.Empty);
CGContext ctx = UIGraphics.GetCurrentContext();
ctx.SetStrokeColor(UIColor.Red.CGColor);
ctx.SetLineWidth(2);
ctx.MoveTo(result.ResultPoints[0].X, result.ResultPoints[0].Y);
ctx.AddLineToPoint(result.ResultPoints[1].X, result.ResultPoints[1].Y);
ctx.StrokePath();
ctx.SetStrokeColor(UIColor.Green.CGColor);
ctx.MoveTo(result.ResultPoints[1].X, result.ResultPoints[1].Y);
ctx.AddLineToPoint(result.ResultPoints[2].X, result.ResultPoints[2].Y);
ctx.StrokePath();
ctx.SetStrokeColor(UIColor.Blue.CGColor);
ctx.MoveTo(result.ResultPoints[2].X, result.ResultPoints[2].Y);
ctx.AddLineToPoint(result.ResultPoints[3].X, result.ResultPoints[3].Y);
ctx.StrokePath();
ctx.SetStrokeColor(UIColor.Yellow.CGColor);
ctx.MoveTo(result.ResultPoints[3].X, result.ResultPoints[3].Y);
ctx.AddLineToPoint(result.ResultPoints[0].X, result.ResultPoints[0].Y);
ctx.StrokePath();
UIImage retImage = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
theView.Image = retImage;
UIButton theBtn = new UIButton(new CGRect(100,380,100,32));
theBtn.SetTitle("Dismiss", UIControlState.Normal);
theBtn.BackgroundColor = UIColor.Red;
this.View.AddSubview(theBtn);
theBtn.TouchUpInside += (object sender, EventArgs e) => {
theView.RemoveFromSuperview();
theBtn.RemoveFromSuperview();
};
});
}
}
else
msg = "Scanning Canceled!";
this.InvokeOnMainThread(() => {
var av = new UIAlertView("Barcode Result", msg, null, "OK", null);
av.Show();
});
}
示例7: HandleLongPressGesture
protected override void HandleLongPressGesture()
{
switch (LongPressGestureRecognizer.State)
{
case UIGestureRecognizerState.Began:
{
// we try to grab the current seelected item and draw a floating copy of it on the Drag Surface
// the copy is just an image of it using RasterizedImage
var currentIndexPath = CollectionView.IndexPathForItemAtPoint(LongPressGestureRecognizer.LocationInView(CollectionView));
SelectedItemIndexPath = currentIndexPath;
if (SelectedItemIndexPath == null)
return;
if (!DataSource.CanMoveItemAtIndexPath(SelectedItemIndexPath))
return;
var collectionViewCell = CollectionView.CellForItem(SelectedItemIndexPath);
var tpoint = DragSurface.ConvertPointFromView(collectionViewCell.Frame.Location, CollectionView);
RectangleF frame = new RectangleF(tpoint.X, tpoint.Y, collectionViewCell.Frame.Size.Width, collectionViewCell.Frame.Size.Height);
CurrentView = new UIView(frame);
collectionViewCell.Highlighted = true;
var highlightedImageView = new UIImageView(RastertizedImage(collectionViewCell));
highlightedImageView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
highlightedImageView.Alpha = 1.0f;
collectionViewCell.Highlighted = false;
var imageView = new UIImageView(RastertizedImage(collectionViewCell));
imageView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
imageView.Alpha = 0.0f;
CurrentView.AddSubview(imageView);
CurrentView.AddSubview(highlightedImageView);
DragSurface.AddSubview(CurrentView); // add this to the top level view so that we can drag outside
CurrentViewCenter = CurrentView.Center;
OnWillBeginDraggingItem(SelectedItemIndexPath);
// we animate the drawing out of the floating copy
UIView.Animate(0.3, 0.0, UIViewAnimationOptions.BeginFromCurrentState,
() =>
{
CurrentView.Transform = CGAffineTransform.MakeScale(1.1f, 1.1f);
highlightedImageView.Alpha = 0.0f;
imageView.Alpha = 1.0f;
},
() =>
{
highlightedImageView.RemoveFromSuperview();
OnDidBegingDraggingItem(SelectedItemIndexPath);
});
InvalidateLayout();
}
break;
case UIGestureRecognizerState.Cancelled:
case UIGestureRecognizerState.Ended:
{
var currentIndexPath = SelectedItemIndexPath;
if (currentIndexPath == null || CurrentView == null)
return;
SelectedItemIndexPath = null;
CurrentViewCenter = PointF.Empty;
OnWillEndDraggingItem(currentIndexPath);
UIView.Animate(0.3, 0.0, UIViewAnimationOptions.BeginFromCurrentState,
() =>
{
var layoutAttributes = this.LayoutAttributesForItem(currentIndexPath);
CurrentView.Transform = CGAffineTransform.MakeScale(1.0f, 1.0f);
CurrentView.Center = CollectionView.ConvertPointToView(layoutAttributes.Center, DragSurface);
},
() =>
{
CurrentView.RemoveFromSuperview();
CurrentView = null;
InvalidateLayout();
OnDidEndDraggingItem(currentIndexPath);
});
}
break;
}
}