本文整理汇总了C#中UIScrollView.ScrollRectToVisible方法的典型用法代码示例。如果您正苦于以下问题:C# UIScrollView.ScrollRectToVisible方法的具体用法?C# UIScrollView.ScrollRectToVisible怎么用?C# UIScrollView.ScrollRectToVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIScrollView
的用法示例。
在下文中一共展示了UIScrollView.ScrollRectToVisible方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
scrollView = new UIScrollView (new RectangleF (0, 0, 320, 480));
this.View.AddSubview (scrollView);
//scrollView.Delegate = new ViewControllerForDuplicateEndCapsDelegate ();
// add the last image (image4) into the first position
this.AddImageWithName ("Images/image4.jpg", 0);
// add all of the images to the scroll view
for (int i = 1; i < 5; i++) {
this.AddImageWithName (string.Format ("Images/image{0}.jpg", i), i);
}
// add the first image (image1) into the last position
this.AddImageWithName ("Images/image1.jpg", 5);
scrollView.PagingEnabled = true;
scrollView.Bounces = true;
scrollView.DelaysContentTouches = true;
scrollView.ShowsHorizontalScrollIndicator = false;
scrollView.ContentSize = new System.Drawing.SizeF (1920, 480);
scrollView.ScrollRectToVisible (new RectangleF (320, 0, 320, 480), true);
scrollView.DecelerationEnded += HandleDecelerationEnded;
}
示例2: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
backBtn.SetImage(Graphics.GetImgResource("back"), UIControlState.Normal);
backBtn.TouchUpInside += HandleBackBtnTouchUpInside;
UpdateTitle();
scrollView = new UIScrollView (new RectangleF (0, this.View.Bounds.Height - h, 320, h));
this.View.AddSubview (scrollView);
mapView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
foreach (var subView in mapView.Subviews)
{
if (subView is UIImageView)
{
subView.Frame = new RectangleF(5, 5, subView.Frame.Width, subView.Frame.Height);
//((UIImageView)subView).Image.SaveToPhotosAlbum(null);
}
}
var view = new UIView(new RectangleF(0, 40, 320, 1));
view.Layer.BackgroundColor = UIColor.LightGray.CGColor;
this.View.AddSubview(view);
scrollView.PagingEnabled = false;
scrollView.Bounces = true;
scrollView.DelaysContentTouches = true;
scrollView.ShowsHorizontalScrollIndicator = true;
scrollView.BackgroundColor = new UIColor (1, 1, 1, 0.6f);
scrollView.ScrollRectToVisible (new RectangleF (w, 0, w, h), true);
scrollView.Scrolled += HandleScrollViewScrolled;
Initialize ();
if (indicator == null) {
indicator = new TriangleView (UIColor.Black, UIColor.Black);
View.AddSubview (indicator);
UpdatePosition (-100, false);
}
}
示例3: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
AddNightFallGradient();
AddButtons();
SetUpMusic();
NSTimer.CreateRepeatingScheduledTimer(1.0, () => {
PopulateTimeInformation();
});
PopulateTimeInformation ();
scrollView = new UIScrollView (new RectangleF (scrollViewPositionX, scrollViewPositionY, scrollViewWidth, scrollViewHeight));
View.AddSubview (scrollView);
scrollView.PagingEnabled = true;
scrollView.Bounces = true;
scrollView.DelaysContentTouches = true;
scrollView.ShowsHorizontalScrollIndicator = true;
scrollView.ContentSize = new System.Drawing.SizeF (scrollViewWidth * 4, scrollViewHeight);
scrollView.ScrollRectToVisible (new RectangleF (0, 0, scrollViewWidth, scrollViewHeight), true);
scrollView.DecelerationEnded += (object sender, EventArgs e) => {
UpdatePageScroll(true);
};
SetUpLabels();
pageControl = new UIPageControl();
pageControl.Center = new PointF(UIScreen.MainScreen.Bounds.Width / 2f, UIScreen.MainScreen.Bounds.Height - 50f);//, UIScreen.MainScreen.Bounds.Height - 150f, 100f, 100f ));
pageControl.Pages = 4;
pageControl.CurrentPage = 0;
if (!UserInterfaceIdiomIsPhone)
View.AddSubview(pageControl);
_time.PropertyChanged += (sender, e) => {
daysUntilXmasLabel.Text = _time.DaysUntil;
label.Text = _time.DaysUntil;
label2.Text = _time.HoursUntil;
label3.Text = _time.MinutesUntil;
label4.Text = _time.SecondsUntil;
};
}
示例4: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
if (Images == null)
{
Images = new List<UIImage>();
foreach (string s in ImagePaths)
{
Images.Add(UIImage.FromBundle(s));
}
}
View.BackgroundColor = UIColor.Black;
View.AutoresizingMask = UIViewAutoresizing.All;
totalPage = Images.Count;
//set View to Full Screen
WantsFullScreenLayout = true;
//Add Done button if modal
if (IsModalView)
{
NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, dismissImageViewer);
}
//Navigationbar and toolbar styling
// NavigationController.NavigationBar.TintColor = UIColor.FromRGB(233, 131, 0);
NavigationController.NavigationBar.Translucent = true;
NavigationController.Toolbar.TintColor = UIColor.FromRGB(233, 131, 0);
NavigationController.Toolbar.Translucent = true;
NavigationController.SetToolbarHidden(false, false);
//set X of UIScrollView for UIImageView
float scrollViewOffset = 0;
imageSizeWidth = (int)View.Frame.Size.Width;
imageSizeHeight = (int)View.Frame.Size.Height + 64;
imageScrollView = new UIScrollView(new RectangleF(0, 0, imageSizeWidth, imageSizeHeight));
imageScrollView.ContentSize = new SizeF(imageSizeWidth * totalPage, imageSizeHeight);
imageScrollView.PagingEnabled = true;
imageScrollView.WeakDelegate = this;
imageScrollView.AutoresizingMask = UIViewAutoresizing.All;
//add UIImageViews to UIScrollView
foreach (UIImage img in Images)
{
UIImageView iv = new UIImageView(img);
iv.AutoresizingMask = UIViewAutoresizing.All;
iv.ContentMode = UIViewContentMode.ScaleAspectFit;
iv.Frame = new RectangleF(scrollViewOffset, 0, imageSizeWidth, imageSizeHeight);
iv.UserInteractionEnabled = true;
imageScrollView.AddSubview(iv);
scrollViewOffset += imageSizeWidth;
}
View.AddSubview(imageScrollView);
//set ScrollView to Currentpage
imageScrollView.ScrollRectToVisible(new RectangleF(CurrentPage * imageSizeWidth, 0, imageSizeWidth, imageSizeHeight), false);
//show Title with currentpage
Title = "Afbeelding " + (CurrentPage + 1) + " van " + totalPage;
//Add UIPageControl to toolbar
pageControl = new UIPageControl(new RectangleF(0, 0, View.Frame.Size.Width, 40));
pageControl.Pages = Images.Count;
pageControl.CurrentPage = CurrentPage;
pageControl.DefersCurrentPageDisplay = true;
pageControl.HidesForSinglePage = false;
UIBarButtonItem[] items = new UIBarButtonItem[]{ new UIBarButtonItem(pageControl) };
ToolbarItems = items;
// Detect orientation changes using an observer
orientationObserver = NSNotificationCenter.DefaultCenter.AddObserver("UIDeviceOrientationDidChangeNotification", handleRotation);
//Add GestureRecognizer to show/hide navigationbar/toolbar/statusbar
UITapGestureRecognizer gesture = new UITapGestureRecognizer(this, new MonoTouch.ObjCRuntime.Selector("ViewTapSelector"));
imageScrollView.AddGestureRecognizer(gesture);
}