本文整理汇总了C#中UIScrollView.AddObserver方法的典型用法代码示例。如果您正苦于以下问题:C# UIScrollView.AddObserver方法的具体用法?C# UIScrollView.AddObserver怎么用?C# UIScrollView.AddObserver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIScrollView
的用法示例。
在下文中一共展示了UIScrollView.AddObserver方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ODRefreshControl
public ODRefreshControl (UIScrollView scrollView, ODRefreshControlLayout layout = ODRefreshControlLayout.Vertical, UIView activity = null)
: base (
(layout == ODRefreshControlLayout.Vertical)
? new RectangleF (0, (-TotalViewHeight - scrollView.ContentInset.Top), scrollView.Bounds.Width, TotalViewHeight)
: new RectangleF ((-TotalViewHeight - scrollView.ContentInset.Left), 0, TotalViewHeight, scrollView.Bounds.Height)
)
{
ScrollView = scrollView;
OriginalContentInset = scrollView.ContentInset;
_vertical = (layout == ODRefreshControlLayout.Vertical);
AutoresizingMask = (_vertical)
? UIViewAutoresizing.FlexibleWidth
: UIViewAutoresizing.FlexibleHeight;
ScrollView.AddSubview (this);
ScrollView.AddObserver (this, new NSString ("contentOffset"), NSKeyValueObservingOptions.New, IntPtr.Zero);
ScrollView.AddObserver (this, new NSString ("contentInset"), NSKeyValueObservingOptions.New, IntPtr.Zero);
_activity = activity ?? new UIActivityIndicatorView (UIActivityIndicatorViewStyle.Gray);
_activity.Center = new PointF ((float) Math.Floor (Bounds.Width / 2.0f), (float) Math.Floor (Bounds.Height / 2.0f));
_activity.AutoresizingMask = (_vertical)
? UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin
: UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin;
_activity.Alpha = 1;
if (_activity is UIActivityIndicatorView) {
((UIActivityIndicatorView) _activity).StartAnimating ();
}
AddSubview (_activity);
_refreshing = false;
_canRefresh = true;
_ignoreInset = false;
_ignoreOffset = false;
_didSetInset = false;
_hasSectionHeaders = false;
_tintColor = UIColor.FromRGB (155, 162, 172);
_shadowColor = UIColor.Black;
_highlightColor = UIColor.White.ColorWithAlpha (.2f);
_shapeLayer = new CAShapeLayer {
FillColor = _tintColor.CGColor,
StrokeColor = UIColor.DarkGray.ColorWithAlpha (.5f).CGColor,
LineWidth = .5f,
ShadowColor = _shadowColor.CGColor,
ShadowOffset = new SizeF (0, 1),
ShadowOpacity = .4f,
ShadowRadius = .5f
};
Layer.AddSublayer (_shapeLayer);
_arrowLayer = new CAShapeLayer {
StrokeColor = UIColor.DarkGray.ColorWithAlpha (.5f).CGColor,
LineWidth = .5f,
FillColor = UIColor.White.CGColor
};
_shapeLayer.AddSublayer (_arrowLayer);
_highlightLayer = new CAShapeLayer {
FillColor = _highlightColor.CGColor
};
_shapeLayer.AddSublayer (_highlightLayer);
if (!_vertical) {
// Highlight layer is currently not shown in horizontal mode
// because it has a wrong path.
// It should instead be drawn all the way from left to right circle.
// Feel free to work on it!
_highlightLayer.RemoveFromSuperLayer ();
}
}