本文整理汇总了C#中UIScrollView类的典型用法代码示例。如果您正苦于以下问题:C# UIScrollView类的具体用法?C# UIScrollView怎么用?C# UIScrollView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIScrollView类属于命名空间,在下文中一共展示了UIScrollView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LayoutSubviews
public override void LayoutSubviews ()
{
// layout the stock UIAlertView control
base.LayoutSubviews ();
if(this.Subviews.Count() == 3)
{
// build out the text field
_UserName = ComposeTextFieldControl (false);
_Password = ComposeTextFieldControl (true);
// add the text field to the alert view
UIScrollView view = new UIScrollView(this.Frame);
view.AddSubview(ComposeLabelControl("Username"));
view.AddSubview (_UserName);
view.AddSubview(ComposeLabelControl("Password"));
view.AddSubview (_Password);
this.AddSubview(view);
}
// shift the contents of the alert view around to accomodate the extra text field
AdjustControlSize ();
}
开发者ID:darkwood,项目名称:Jaktloggen,代码行数:28,代码来源:UIPopupLoginView.cs
示例2: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
_canvasView = new UIView
{
BackgroundColor = CanvasBackgroundColor,
Bounds = new CGRect(CGPoint.Empty, CanvasSize),
};
_scrollView = new UIScrollView()
{
ContentSize = CanvasSize,
ViewForZoomingInScrollView = sv => _canvasView,
BackgroundColor = ScrollViewBackgroundColor,
};
_scrollView.AddSubview(_canvasView);
View.AddSubview(_scrollView);
AddGestures();
AddInitialElements();
}
开发者ID:TheRealAdamKemp,项目名称:GestureRecognizerPresentation,代码行数:25,代码来源:GestureViewController.cs
示例3: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
float h = 50.0f;
float w = 50.0f;
float padding = 10.0f;
int n = 25;
_scrollView = new UIScrollView {
Frame = new RectangleF (0, 0, View.Frame.Width, h + 2 * padding),
ContentSize = new SizeF ((w + padding) * n, h),
BackgroundColor = UIColor.DarkGray,
AutoresizingMask = UIViewAutoresizing.FlexibleWidth
};
for (int i=0; i<n; i++) {
var button = UIButton.FromType (UIButtonType.RoundedRect);
button.SetTitle (i.ToString (), UIControlState.Normal);
button.Frame = new RectangleF (padding * (i + 1) + (i * w), padding, w, h);
_scrollView.AddSubview (button);
_buttons.Add (button);
}
View.AddSubview (_scrollView);
}
开发者ID:omxeliw,项目名称:recipes,代码行数:26,代码来源:ScrollingButtonsController.cs
示例4: PdfViewController
public PdfViewController (NSUrl url) : base()
{
Url = url;
View = new UIView ();
View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
View.AutosizesSubviews = true;
PdfDocument = CGPDFDocument.FromUrl (Url.ToString ());
// For demo purposes, show first page only.
PdfPage = PdfDocument.GetPage (1);
PdfPageRect = PdfPage.GetBoxRect (CGPDFBox.Crop);
// Setup tiled layer.
TiledLayer = new CATiledLayer ();
TiledLayer.Delegate = new TiledLayerDelegate (this);
TiledLayer.TileSize = new SizeF (1024f, 1024f);
TiledLayer.LevelsOfDetail = 5;
TiledLayer.LevelsOfDetailBias = 5;
TiledLayer.Frame = PdfPageRect;
ContentView = new UIView (PdfPageRect);
ContentView.Layer.AddSublayer (TiledLayer);
// Prepare scroll view.
ScrollView = new UIScrollView (View.Frame);
ScrollView.AutoresizingMask = View.AutoresizingMask;
ScrollView.Delegate = new ScrollViewDelegate (this);
ScrollView.ContentSize = PdfPageRect.Size;
ScrollView.MaximumZoomScale = 10f;
ScrollView.MinimumZoomScale = 1f;
ScrollView.ScrollEnabled = true;
ScrollView.AddSubview (ContentView);
View.AddSubview (ScrollView);
}
开发者ID:21Off,项目名称:21Off,代码行数:35,代码来源:PdfViewController.cs
示例5: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
scrollView = new UIScrollView (
new RectangleF (0, 0, View.Frame.Width,
View.Frame.Height));
View.AddSubview (scrollView);
imageView = new UIImageView (UIImage.FromBundle ("heinz-map.png"));
scrollView.ContentSize = imageView.Image.Size;
scrollView.AddSubview (imageView);
scrollView.MaximumZoomScale = 0.7f;
scrollView.MinimumZoomScale = 0.4f;
scrollView.ContentOffset = new PointF (0, 500);
scrollView.ZoomScale = 5f;
scrollView.ViewForZoomingInScrollView += (UIScrollView svm) => {
return imageView;
};
UITapGestureRecognizer doubletap = new UITapGestureRecognizer(OnDoubleTap) {
NumberOfTapsRequired = 2 // double tap
};
scrollView.AddGestureRecognizer(doubletap);
}
开发者ID:cdmedia,项目名称:heinzight,代码行数:26,代码来源:MapViewController.cs
示例6: ImageGalleryView
public ImageGalleryView (RectangleF frame, ObservableCollection<string> images = null) : base (frame)
{
this.AutoresizingMask = UIViewAutoresizing.All;
this.ContentMode = UIViewContentMode.ScaleToFill;
FadeImages = true;
this.BackgroundColor = UIColor.White;
if (frame == default(RectangleF))
this.Frame = UIScreen.MainScreen.Bounds;
else
this.Frame = frame;
if (images == null)
Images = new ObservableCollection<string> ();
else
Images = images;
pageControl = new UIPageControl ();
pageControl.AutoresizingMask = UIViewAutoresizing.All;
pageControl.ContentMode = UIViewContentMode.ScaleToFill;
pageControl.ValueChanged += (object sender, EventArgs e) => UpdateScrollPositionBasedOnPageControl();
scroller = new UIScrollView ();
scroller.AutoresizingMask = UIViewAutoresizing.All;
scroller.ShowsHorizontalScrollIndicator = scroller.ShowsVerticalScrollIndicator = false;
scroller.ContentMode = UIViewContentMode.ScaleToFill;
scroller.PagingEnabled = true;
scroller.Bounces = false;
this.Add (scroller);
this.Add (pageControl);
}
开发者ID:Gunner92,项目名称:Xamarin-Forms-Labs,代码行数:34,代码来源:ImageGalleryView.cs
示例7: Init
public void Init()
{
this.ResetTimer = base.transform.Find("time1").GetComponent<UILabel>();
Transform transform = base.transform.Find("RewardBK");
this.Title = transform.transform.Find("Title").GetComponent<UILabel>();
this.Reward = transform.transform.Find("Reward");
this.Price = transform.transform.Find("Price").GetComponent<UILabel>();
this.OffPrice = transform.transform.Find("OffPrice").GetComponent<UILabel>();
this.BuyVIPLevel = transform.transform.Find("BuyVIPLevel").GetComponent<UILabel>();
this.CurVipLevel = transform.transform.Find("CurVipLevel").GetComponent<UILabel>();
this.ToBuy = transform.transform.Find("GoBtn");
this.Buyed = transform.transform.Find("Buy");
UIEventListener expr_105 = UIEventListener.Get(this.ToBuy.gameObject);
expr_105.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_105.onClick, new UIEventListener.VoidDelegate(this.OnBuyVipWeekReward));
this.rewardScrollView = base.transform.Find("rewardPanel").GetComponent<UIScrollView>();
this.rewardTable = this.rewardScrollView.transform.Find("rewardContents").GetComponent<UITable>();
for (int i = 0; i <= 15; i++)
{
this.VIPLevel[i] = this.rewardTable.transform.Find(string.Format("{0:D2}", i)).GetComponent<UISprite>();
UIEventListener expr_1A7 = UIEventListener.Get(this.VIPLevel[i].gameObject);
expr_1A7.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_1A7.onClick, new UIEventListener.VoidDelegate(this.OnVIPLevelClicked));
}
this.mTabBtnScrollBar = base.transform.Find("scrollBar").GetComponent<UIScrollBar>();
EventDelegate.Add(this.mTabBtnScrollBar.onChange, new EventDelegate.Callback(this.OnScrollBarValueChange));
this.leftBtn = base.transform.Find("LeftBtn").gameObject;
this.rightBtn = base.transform.Find("RightBtn").gameObject;
UIEventListener expr_24D = UIEventListener.Get(this.leftBtn);
expr_24D.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_24D.onClick, new UIEventListener.VoidDelegate(this.OnLeftBtnClicked));
UIEventListener expr_279 = UIEventListener.Get(this.rightBtn);
expr_279.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_279.onClick, new UIEventListener.VoidDelegate(this.OnRightBtnClicked));
this.RefreshCurLevelToggle();
this.RefreshCurLevelInfo();
}
开发者ID:floatyears,项目名称:Decrypt,代码行数:33,代码来源:GUIVIPWeekRewardInfo.cs
示例8: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// set the background color of the view to white
this.View.BackgroundColor = UIColor.White;
this.Title = "Scroll View";
// create our scroll view
scrollView = new UIScrollView (
new CGRect (0, 0, View.Frame.Width
, View.Frame.Height - NavigationController.NavigationBar.Frame.Height));
View.AddSubview (scrollView);
// create our image view
imageView = new UIImageView (UIImage.FromFile ("halloween.jpg"));
scrollView.ContentSize = imageView.Image.Size;
scrollView.AddSubview (imageView);
// set allow zooming
scrollView.MaximumZoomScale = 3f;
scrollView.MinimumZoomScale = .1f;
scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };
// Create a new Tap Gesture Recognizer
UITapGestureRecognizer doubletap = new UITapGestureRecognizer(OnDoubleTap) {
NumberOfTapsRequired = 2 // double tap
};
scrollView.AddGestureRecognizer(doubletap); // detect when the scrollView is double-tapped
}
开发者ID:eduardoguilarducci,项目名称:recipes,代码行数:31,代码来源:ScrollViewController.cs
示例9: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
pickerDataModel = new PickerDataModel ();
// set our initial selection on the label
this.labelListitems.Text = pickerDataModel.SelectedItem.ToString();
_scrollViewSyllabus = new UIScrollView {
Frame = new RectangleF (0, 100, View.Frame.Width,
h + 2 * padding),
ContentSize = new SizeF ((w + padding) * n, h),
BackgroundColor = UIColor.Orange,
AutoresizingMask = UIViewAutoresizing.FlexibleWidth
};
_scrollViewYear = new UIScrollView {
Frame = new RectangleF (0, 20, View.Frame.Width,
h + 2 * padding),
ContentSize = new SizeF ((w + padding) * n, h),
BackgroundColor = UIColor.Orange,
AutoresizingMask = UIViewAutoresizing.FlexibleWidth
};
PreapareScrollers ();
//View.AddSubviews (pickeritems);
// Perform any additional setup after loading the view, typically from a nib.
}
开发者ID:jp106,项目名称:XamarinRepo,代码行数:27,代码来源:FirstiOSViewController.cs
示例10: ImageGalleryView
/// <summary>
/// Initializes a new instance of the <see cref="ImageGalleryView"/> class.
/// </summary>
/// <param name="frame">The frame.</param>
/// <param name="images">The images.</param>
public ImageGalleryView(CGRect frame, ObservableCollection<string> images = null)
: base(frame)
{
AutoresizingMask = UIViewAutoresizing.All;
ContentMode = UIViewContentMode.ScaleToFill;
FadeImages = true;
BackgroundColor = UIColor.White;
Frame = frame == default(CGRect) ? UIScreen.MainScreen.Bounds : frame;
Images = images ?? new ObservableCollection<string>();
_pageControl = new UIPageControl
{
AutoresizingMask = UIViewAutoresizing.All,
ContentMode = UIViewContentMode.ScaleToFill
};
_pageControl.ValueChanged += (object sender, EventArgs e) => UpdateScrollPositionBasedOnPageControl();
_scroller = new UIScrollView
{
AutoresizingMask = UIViewAutoresizing.All,
ContentMode = UIViewContentMode.ScaleToFill,
PagingEnabled = true,
Bounces = false,
ShowsHorizontalScrollIndicator = false,
ShowsVerticalScrollIndicator = false
};
Add(_scroller);
Add(_pageControl);
}
开发者ID:Jaskomal,项目名称:Xamarin-Forms-Labs,代码行数:40,代码来源:ImageGalleryView.cs
示例11: SetupUserInterface
private void SetupUserInterface ()
{
scrollView = new UIScrollView {
BackgroundColor = UIColor.Clear.FromHexString ("#336699", 1.0f),
Frame = new CGRect (0, 0, Frame.Width, Frame.Height)
};
licensureLabel = new UILabel {
Font = UIFont.FromName ("SegoeUI-Light", 30f),
Frame = new CGRect (0, 20, Frame.Width, 35),
Text = "Terms of Service",
TextAlignment = UITextAlignment.Center,
TextColor = UIColor.White
};
textView = new UITextView {
BackgroundColor = UIColor.Clear,
Font = UIFont.FromName ("SegoeUI-Light", 15f),
Frame = new CGRect (20, 50, Frame.Width - 40, Frame.Height * 1.75),
Text = "Willie’s Cycle will assume no damage liability from the sales of used or new parts. This damage includes personal injury, property, vehicle, monetary, punitive, emotional, and mental damage. All risk and liability is assumed by the purchaser or the installer of any product sold by Willie’s Cycle. Willie’s Cycle cannot be held liable for any of the following reasons: damage to person or property, including damage or injury to driver, passenger, or any other person, animal or property damage that may occur have occurred after purchasing any product from Willie’s Cycle. Willie’s Cycle will only accept returns for parts to be used in store credit or, at our discretion. Willie’s Cycle will give refunds due to applications not being as described. Willie’s Cycle will only give credit or refund up to full purchase amount of the product. Willie’s Cycle may charge a restock fee for returned parts. This restock fee is a minimum of 20% of the purchase price. All parts are expected to have normal wear, and in no way do we consider used parts to be in any condition other than used functional parts with wear, unless otherwise noted. Any returns must be sent with return authorization. RA# may be granted by providing the following: Date of purchase, transaction number, year, model, make, and VIN number of vehicle. Returns can be rejected if purchase was made on account of buyer error. Amount of refund or credit is determined solely by Willie’s Cycle. Returned item must be received by Willie’s Cycle within 30 days of original purchase date. All returned items must be returned in the same condition as they were received.",
TextColor = UIColor.White,
UserInteractionEnabled = false
};
scrollView.ContentSize = new CGSize (Frame.Width, Frame.Height * 1.75);
scrollView.Add (licensureLabel);
scrollView.Add (textView);
Add (scrollView);
}
开发者ID:Cmaster14,项目名称:WilliesCycleApps,代码行数:30,代码来源:DisclaimerView.cs
示例12: DraggingEnded
public void DraggingEnded(UIScrollView scrollView, bool willDecelerate)
{
if (_table.ContentOffset.Y <= -65f) {
//ReloadTimer = NSTimer.CreateRepeatingScheduledTimer (new TimeSpan (0, 0, 0, 10, 0), () => dataSourceDidFinishLoadingNewData ());
_reloadTimer = NSTimer.CreateScheduledTimer (TimeSpan.FromSeconds (2f), delegate {
// for this demo I cheated and am just going to pretend data is reloaded
// in real world use this function to really make sure data is reloaded
_reloadTimer = null;
Console.WriteLine ("dataSourceDidFinishLoadingNewData() called from NSTimer");
_reloading = false;
_refreshHeaderView.FlipImageAnimated (false);
_refreshHeaderView.ToggleActivityView ();
UIView.BeginAnimations ("DoneReloadingData");
UIView.SetAnimationDuration (0.3);
_table.ContentInset = new UIEdgeInsets (0f, 0f, 0f, 0f);
_refreshHeaderView.SetStatus (TableViewPullRefresh.RefreshTableHeaderView.RefreshStatus.PullToReloadStatus);
UIView.CommitAnimations ();
_refreshHeaderView.SetCurrentDate ();
});
_reloading = true;
_table.ReloadData ();
_refreshHeaderView.ToggleActivityView ();
UIView.BeginAnimations ("ReloadingData");
UIView.SetAnimationDuration (0.2);
_table.ContentInset = new UIEdgeInsets (60f, 0f, 0f, 0f);
UIView.CommitAnimations ();
}
_checkForRefresh = false;
}
开发者ID:Snowing,项目名称:MTTweetieTableViewPullRefresh,代码行数:34,代码来源:RefreshingUITableViewController.cs
示例13: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
// set the background color of the view to white
this.View.BackgroundColor = UIColor.White;
this.Title = "Mecut Dosya";
// create our scroll view
scrollView = new UIScrollView (
new RectangleF (0, 0, View.Frame.Width
, View.Frame.Height - NavigationController.NavigationBar.Frame.Height));
View.AddSubview (scrollView);
string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string localFilename = "original.jpg";
string localPath = Path.Combine(documentsPath, localFilename);
// create our image view
imageView = new UIImageView (UIImage.FromFile (localPath));
scrollView.ContentSize = imageView.Image.Size;
scrollView.AddSubview (imageView);
// set allow zooming
scrollView.MaximumZoomScale = 3f;
scrollView.MinimumZoomScale = .1f;
scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };
// configure a double-tap gesture recognizer
UITapGestureRecognizer doubletap = new UITapGestureRecognizer();
doubletap.NumberOfTapsRequired = 2;
doubletap.AddTarget (this, new MonoTouch.ObjCRuntime.Selector("DoubleTapSelector"));
scrollView.AddGestureRecognizer(doubletap);
}
开发者ID:hhempel,项目名称:StoryboardTables,代码行数:35,代码来源:imageViewCode.cs
示例14: InitWindowOnAwake
public override void InitWindowOnAwake()
{
this.windowID = WindowID.WindowID_Rank;
this.preWindowID = WindowID.WindowID_MainMenu;
InitWindowData();
base.InitWindowOnAwake();
// this.RegisterReturnLogic(RetrunPreLogic);
objEffect = GameUtility.FindDeepChild(this.gameObject, "EffectParent");
itemsGrid = GameUtility.FindDeepChild(this.gameObject, "LeftAnchor/LeftMain/Scroll View/Grid");
trsAnimation = GameUtility.FindDeepChild(this.gameObject, "LeftAnchor/LeftMain");
scrollView = GameUtility.FindDeepChild<UIScrollView>(this.gameObject, "LeftAnchor/LeftMain/Scroll View");
btnGoToMatch = GameUtility.FindDeepChild(this.gameObject, "Btn_GotoMatch").gameObject;
rankWindowManager = this.gameObject.GetComponent<UIRankManager>();
if (rankWindowManager == null)
{
rankWindowManager = this.gameObject.AddComponent<UIRankManager>();
rankWindowManager.InitWindowManager();
}
UIEventListener.Get(btnGoToMatch).onClick = delegate
{
GameMonoHelper.GetInstance().LoadGameScene("AnimationCurve",
delegate
{
UIManager.GetInstance().ShowWindow(WindowID.WindowID_Matching);
UIManager.GetInstance().GetGameWindowScript<UIMatching>(WindowID.WindowID_Matching).SetMatchingData(this.windowID);
});
};
}
开发者ID:CcUseGitHubLearn,项目名称:UIFrameWork,代码行数:32,代码来源:UIRank.cs
示例15: FinishedLaunching
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
UIApplication.SharedApplication.SetStatusBarHidden(true, true);
var scrollView = new UIScrollView(window.Bounds);
window.AddSubview(scrollView);
var view = new HypnosisView() { Frame = window.Bounds };
scrollView.AddSubview(view);
scrollView.ContentSize = window.Bounds.Size;
scrollView.MinimumZoomScale = 1.0f;
scrollView.MaximumZoomScale = 5.0f;
scrollView.Delegate = new HSAnonScrollViewerDelegate(sv => {
return view;
});
window.BackgroundColor = UIColor.White;
// make the window visible
window.MakeKeyAndVisible ();
return true;
}
开发者ID:paulcbetts,项目名称:BigNerdIOS-MonoDevelop,代码行数:34,代码来源:AppDelegate.cs
示例16: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
// set the background color of the view to white
this.View.BackgroundColor = UIColor.White;
this.Title = "Scroll View";
// create our scroll view
scrollView = new UIScrollView (
new RectangleF (0, 0, View.Frame.Width
, View.Frame.Height - NavigationController.NavigationBar.Frame.Height));
View.AddSubview (scrollView);
// create our image view
imageView = new UIImageView (UIImage.FromFile ("halloween.jpg"));
scrollView.ContentSize = imageView.Image.Size;
scrollView.AddSubview (imageView);
// set allow zooming
scrollView.MaximumZoomScale = 3f;
scrollView.MinimumZoomScale = .1f;
scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };
}
开发者ID:omxeliw,项目名称:recipes,代码行数:25,代码来源:ScrollViewController.cs
示例17: ViewDidLoad
public override void ViewDidLoad()
{
View.BackgroundColor = UIColor.White;
nameLabel = new UILabel () {
TextAlignment = UITextAlignment.Left,
Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font16pt),
BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
};
descriptionTextView = new UITextView () {
TextAlignment = UITextAlignment.Left,
Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font10_5pt),
BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f),
Editable = false
};
image = new UIImageView () { ContentMode = UIViewContentMode.ScaleAspectFit };
if (AppDelegate.IsPad) {
View.AddSubview (nameLabel);
View.AddSubview (descriptionTextView);
View.AddSubview (image);
} else {
scrollView = new UIScrollView();
scrollView.AddSubview (nameLabel);
scrollView.AddSubview (descriptionTextView);
scrollView.AddSubview (image);
Add (scrollView);
}
}
开发者ID:kenibarwick,项目名称:ComDayBe2013,代码行数:32,代码来源:UserGroupDetailsScreen.cs
示例18: Recenter
/// <summary>
/// Recenter the draggable list on the center-most child.
/// </summary>
public void Recenter()
{
var trans = transform;
if (trans.childCount == 0) return;
if (uiGrid == null)
{
uiGrid = GetComponent<UIGrid>();
}
if (mScrollView == null)
{
mScrollView = NGUITools.FindInParents<UIScrollView>(gameObject);
if (mScrollView == null)
{
Debug.LogWarning(GetType() + " requires " + typeof(UIScrollView) + " on a parent object in order to work", this);
enabled = false;
return;
}
mScrollView.onDragFinished = OnDragFinished;
if (mScrollView.horizontalScrollBar != null)
mScrollView.horizontalScrollBar.onDragFinished = OnDragFinished;
if (mScrollView.verticalScrollBar != null)
mScrollView.verticalScrollBar.onDragFinished = OnDragFinished;
}
if (mScrollView.panel == null) return;
// Calculate the panel's center in world coordinates
var corners = mScrollView.panel.worldCorners;
var panelCenter = (corners[2] + corners[0]) * 0.5f;
// Offset this value by the momentum
var pickingPoint = panelCenter - mScrollView.currentMomentum * (mScrollView.momentumAmount * 0.1f);
mScrollView.currentMomentum = Vector3.zero;
var visibleItems = 0;
if (mScrollView.movement == UIScrollView.Movement.Horizontal)
{
visibleItems = Mathf.FloorToInt(mScrollView.panel.width / uiGrid.cellWidth);
}
if (mScrollView.movement == UIScrollView.Movement.Vertical)
{
visibleItems = Mathf.FloorToInt(mScrollView.panel.height / uiGrid.cellHeight);
}
var maxPerLine = uiGrid.maxPerLine != 0
? uiGrid.maxPerLine
: (uiGrid.arrangement == UIGrid.Arrangement.Horizontal
? Mathf.FloorToInt(mScrollView.panel.width / uiGrid.cellWidth)
: Mathf.FloorToInt(mScrollView.panel.height / uiGrid.cellHeight));
if(uiGrid.transform.childCount <= maxPerLine * visibleItems)
{
return;
}
var closestPos = visibleItems % 2 == 0
? FindClosestForEven(pickingPoint, maxPerLine, visibleItems / 2)
: FindClosestForOdd(pickingPoint, maxPerLine, visibleItems / 2);
CenterOnPos(closestPos);
}
开发者ID:wuxin0602,项目名称:Nothing,代码行数:64,代码来源:CustomCenterOnChild.cs
示例19: Start
void Start()
{
_uiPanel = GetComponent<UIPanel>();
_uiScrollView = GetComponent<UIScrollView>();
if(_uiScrollView != null)
_originalUiScrollViewMomentum = _uiScrollView.currentMomentum;
}
开发者ID:odasaburo,项目名称:ActiveLife,代码行数:7,代码来源:BoundObjectsHeight.cs
示例20: NativeInit
protected internal override void NativeInit()
{
if (Parent != null)
{
if (this.NativeUIElement == null)
{
var scroll = new UIScrollView();
scroll.BackgroundColor = UIColor.Clear;
this.NativeUIElement = scroll;
this.NativeUIElement.ClipsToBounds = true;
this.lastContentOfset = CGPoint.Empty;
scroll.Scrolled += (sender, e) =>
{
this.OnScrollChanged(new ScrollChangedEventArgs
{
VerticalOffset = scroll.ContentOffset.Y,
HorizontalOffset = scroll.ContentOffset.X,
VerticalChange = scroll.ContentOffset.Y - this.lastContentOfset.Y,
HorizontalChange = scroll.ContentOffset.X - this.lastContentOfset.X,
});
this.lastContentOfset = scroll.ContentOffset;
};
}
base.NativeInit();
}
}
开发者ID:evnik,项目名称:UIFramework,代码行数:26,代码来源:ScrollViewer.iOS.cs
注:本文中的UIScrollView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论