本文整理汇总了C#中UIEdgeInsets类的典型用法代码示例。如果您正苦于以下问题:C# UIEdgeInsets类的具体用法?C# UIEdgeInsets怎么用?C# UIEdgeInsets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIEdgeInsets类属于命名空间,在下文中一共展示了UIEdgeInsets类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LayoutSubviews
public override void LayoutSubviews()
{
base.LayoutSubviews();
SeparatorInset = new UIEdgeInsets(0, Bounds.Width, 0, 0);
TextView.Frame = new RectangleF(0, 0, ContentView.Frame.Width, ContentView.Frame.Height);
TextView.LayoutIfNeeded();
}
示例2: KeyboardDidShowNotification
protected virtual void KeyboardDidShowNotification(NSNotification notification)
{
UIView activeView = KeyboardGetActiveView();
if (activeView == null)
return;
((UITextField)activeView).ShowDoneButtonOnKeyboard();
UIScrollView scrollView = activeView.FindSuperviewOfType(this.View, typeof(UIScrollView)) as UIScrollView;
if (scrollView == null)
return;
RectangleF keyboardBounds = UIKeyboard.BoundsFromNotification(notification);
UIEdgeInsets contentInsets = new UIEdgeInsets(0.0f, 0.0f, keyboardBounds.Size.Height, 0.0f);
scrollView.ContentInset = contentInsets;
scrollView.ScrollIndicatorInsets = contentInsets;
// If activeField is hidden by keyboard, scroll it so it's visible
RectangleF viewRectAboveKeyboard = new RectangleF(this.View.Frame.Location, new SizeF(this.View.Frame.Width, this.View.Frame.Size.Height - keyboardBounds.Size.Height));
RectangleF activeFieldAbsoluteFrame = activeView.Superview.ConvertRectToView(activeView.Frame, this.View);
// activeFieldAbsoluteFrame is relative to this.View so does not include any scrollView.ContentOffset
// Check if the activeField will be partially or entirely covered by the keyboard
if (!viewRectAboveKeyboard.Contains(activeFieldAbsoluteFrame)) {
// Scroll to the activeField Y position + activeField.Height + current scrollView.ContentOffset.Y - the keyboard Height
PointF scrollPoint = new PointF(0.0f, activeFieldAbsoluteFrame.Location.Y + activeFieldAbsoluteFrame.Height + scrollView.ContentOffset.Y - viewRectAboveKeyboard.Height);
scrollView.SetContentOffset(scrollPoint, true);
}
}
示例3: UpdateWidth
public void UpdateWidth(int itemsCount, float width)
{
float interval = width / (itemsCount + 1);
SectionInset = new UIEdgeInsets(0, interval - ITEM_SIZE / 2, 0, 0);
MinimumLineSpacing = interval - ITEM_SIZE;
}
示例4: ImagePanScrollBarView
public ImagePanScrollBarView(RectangleF frame, UIEdgeInsets edgeInsets)
: base(frame)
{
var scrollbarPath = UIBezierPath.Create ();
scrollbarPath.MoveTo (new PointF (edgeInsets.Left, Bounds.Height - edgeInsets.Bottom));
scrollbarPath.AddLineTo (new PointF (Bounds.Width - edgeInsets.Right, Bounds.Height - edgeInsets.Bottom));
var backgroundLayer = new CAShapeLayer () {
Path = scrollbarPath.CGPath,
LineWidth = 1,
StrokeColor = UIColor.White.ColorWithAlpha (.1f).CGColor,
FillColor = UIColor.Clear.CGColor
};
scrollbarLayer = new CAShapeLayer () {
Path = scrollbarPath.CGPath,
LineWidth = 1,
StrokeColor = UIColor.White.CGColor,
FillColor = UIColor.Clear.CGColor,
Actions = new NSDictionary ("strokeStart", NSNull.Null, "strokeEnd", NSNull.Null)
};
Layer.AddSublayer (backgroundLayer);
Layer.AddSublayer (scrollbarLayer);
}
示例5: LayoutSubviews
public override void LayoutSubviews()
{
base.LayoutSubviews();
if (ImageView != null)
{
var center = ImageView.Center;
ImageView.Frame = new CGRect(0, 0, ImageSize, ImageSize);
ImageView.Center = new CGPoint(ImageSize, center.Y);
if (RoundedImage)
{
ImageView.Layer.MasksToBounds = true;
ImageView.Layer.CornerRadius = ImageSize / 2f;
}
else
{
ImageView.Layer.MasksToBounds = false;
ImageView.Layer.CornerRadius = 0;
}
if (TextLabel != null)
{
var frame = TextLabel.Frame;
frame.X = ImageSize * 2;
frame.Width += (TextLabel.Frame.X - frame.X);
TextLabel.Frame = frame;
}
}
SeparatorInset = new UIEdgeInsets(0, TextLabel.Frame.Left, 0, 0);
SetupNotificationView();
}
示例6: Draw
public override void Draw(CGRect rect)
{
base.Draw(rect);
if (BorderWidthAll > 0)
{
BorderWidth = new UIEdgeInsets(BorderWidthAll, BorderWidthAll, BorderWidthAll, BorderWidthAll);
}
if (BorderColorAll != null)
{
BorderColorTop = BorderColorBottom = BorderColorLeft = BorderColorRight = BorderColorAll;
}
var xMin = rect.GetMinX();
var xMax = rect.GetMaxX();
var yMin = rect.GetMinY();
var yMax = rect.GetMaxY();
var fWidth = this.Frame.Size.Width;
var fHeight = this.Frame.Size.Height;
var context = UIGraphics.GetCurrentContext();
if (context != null)
DrawBorders(context, xMin, xMax, yMin, yMax, fWidth, fHeight);
}
示例7: CardLayoutFlow
public CardLayoutFlow(UIView superView)
{
_superView = superView;
ItemSize = new SizeF(100.0f, 153.0f);
SectionInset = new UIEdgeInsets(0, 60, 0, 60);
ScrollDirection = UICollectionViewScrollDirection.Horizontal;
}
示例8: InsetRect
// Workaround until this method is available in Xamarin.iOS
public static CoreGraphics.CGRect InsetRect(CoreGraphics.CGRect rect, UIEdgeInsets insets)
{
return new CoreGraphics.CGRect(rect.X + insets.Left,
rect.Y + insets.Top,
rect.Width - insets.Left - insets.Right,
rect.Height - insets.Top - insets.Bottom);
}
示例9: LineLayout
public LineLayout ()
{
ItemSize = new CGSize (ITEM_SIZE, ITEM_SIZE);
ScrollDirection = UICollectionViewScrollDirection.Horizontal;
SectionInset = new UIEdgeInsets (200, 0.0f, 200, 0.0f);
MinimumLineSpacing = 50.0f;
}
示例10: ApplyPadding
partial void ApplyPadding(System.Windows.Thickness padding)
{
var inset = new UIEdgeInsets(padding.TopF(), padding.LeftF(), padding.BottomF(), padding.RightF());
var tableView = (UITableView)this.NativeUIElement;
tableView.ContentInset = inset;
tableView.ScrollIndicatorInsets = inset;
}
示例11: AwakeFromNib
public override void AwakeFromNib()
{
base.AwakeFromNib();
TitleEdgeInsets = new UIEdgeInsets(0, 10, 0, 0);
SetImage(BACK_IMAGE, UIControlState.Normal);
}
示例12: ButtonImage
public static UIImage ButtonImage (UIColor color, float cornerRadius, UIColor shadowColor, UIEdgeInsets shadowInsets)
{
UIImage topImage = ImageWithColor (color, cornerRadius);
UIImage bottomImage = ImageWithColor (shadowColor, cornerRadius);
float totalHeight = EdgeSizeFromCornerRadius (cornerRadius) + shadowInsets.Top + shadowInsets.Bottom;
float totalWidth = EdgeSizeFromCornerRadius (cornerRadius) + shadowInsets.Left + shadowInsets.Right;
float topWidth = EdgeSizeFromCornerRadius (cornerRadius);
float topHeight = EdgeSizeFromCornerRadius (cornerRadius);
RectangleF topRect = new RectangleF (shadowInsets.Left, shadowInsets.Top, topWidth, topHeight);
RectangleF bottomRect = new RectangleF (0, 0, totalWidth, totalHeight);
UIGraphics.BeginImageContextWithOptions (new SizeF (totalWidth, totalHeight), false, 0.0f);
if (!RectangleF.Equals (bottomRect, topRect)) {
bottomImage.Draw (bottomRect);
}
topImage.Draw (topRect);
UIImage buttonImage = UIGraphics.GetImageFromCurrentImageContext ();
UIGraphics.EndImageContext ();
UIEdgeInsets resizeableInsets = new UIEdgeInsets (cornerRadius + shadowInsets.Top,
cornerRadius + shadowInsets.Left,
cornerRadius + shadowInsets.Bottom,
cornerRadius + shadowInsets.Right);
return buttonImage.CreateResizableImage (resizeableInsets);
}
示例13: OnKeyboardNotification
private void OnKeyboardNotification (NSNotification notification)
{
var keyboardFrame = UIKeyboard.FrameEndFromNotification (notification);
var inset = new UIEdgeInsets(0, 0, keyboardFrame.Height, 0);
TableView.ContentInset = inset;
TableView.ScrollIndicatorInsets = inset;
}
示例14: PackageManagerButton
public PackageManagerButton()
{
BackgroundColor = Colors.AppleBlue;
SetTitleColor(UIColor.White, UIControlState.Normal);
Layer.CornerRadius = 5;
HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
TitleEdgeInsets = new UIEdgeInsets(0, 0, 0, 10);
}
示例15: CustomTableView
public CustomTableView(RectangleF bounds, UITableViewStyle style) : base(bounds, style)
{
ApplyDropShadow();
// Necessary because we are using a transparent navigation bar setting
// http://stackoverflow.com/questions/2339620/uitableview-add-content-offset-at-top
ContentInset = new UIEdgeInsets(44, 0, 0, 0);
}