/// <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); }
/// <summary> /// Initializes a new instance of the <see cref="SuperKoikoukesse.iOS.CardsController"/> class. /// </summary> /// <param name="scrollView">Scroll view.</param> /// <param name="pageControl">Page control.</param> public CardsController(UIScrollView scrollView, UIPageControl pageControl) { _scrollView = scrollView; _pageControl = pageControl; _cards = new List<AbstractCardViewController>(); }
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); }
public override void ViewDidLoad() { base.ViewDidLoad (); View.SetStyleId("sample-page-control-background"); _pageControl = new UIPageControl(); _pageControl.Pages = 5; _pageControl.SetStyleId("sample-page-control"); View.AddSubview(_pageControl); }
private void Initialize () { Title = _raum.Title; lblSubtitle = new UILabel (){ Font = subTitleFont, TextColor = Resources.Colors.Background, Lines = 0, }; lblDescription = new UILabel (){ Font = titleFont, TextColor = Resources.Colors.Background, Lines = 0, }; lblSeats = new UILabel (){ Font = titleFont, TextColor = Resources.Colors.Background, Lines = 0, }; lblArea = new UILabel (){ Font = titleFont, TextColor = Resources.Colors.Background, Lines = 0, }; imgViewBackground = new UIImageView (); /* imgViewRaum = new UIImageView (){ BackgroundColor = UIColor.Clear, }; */ _pageControl = new UIStyledPageControl{ HidesForSinglePage = true, //Pages = 0, }; _pageControl.ValueChanged += HandlePageControlValueChanged; _scrollView = new UIScrollView (){ ShowsHorizontalScrollIndicator = false, ShowsVerticalScrollIndicator = false, Bounces = true, PagingEnabled = true, }; _scrollView.DecelerationEnded += HandleScrollViewDecelerationEnded; }
private void Initialize () { Title = Locale.GetText ("Historie"); _historys = HistoryRepository.GetHistorys (xmlPath); _totalPages = _historys.Count; _pageControl = new UIPageControl (){ Pages = TotalPages, Frame = new RectangleF (0, 390, 320, 20) }; _pageControl.ValueChanged += HandlePageControlValueChanged; }
public ImageGalleryUIView(CGRect frame, ObservableCollection<string> imgs = null) : base(frame) { AutoresizingMask = UIViewAutoresizing.All; ContentMode = UIViewContentMode.ScaleToFill; FadeImages = true; BackgroundColor = UIColor.White; Frame = frame == default(CGRect) ? UIScreen.MainScreen.Bounds : frame; images = imgs ?? new ObservableCollection<string> (); images.CollectionChanged += HandleCollectionChanged; pageControl = new UIPageControl { AutoresizingMask = UIViewAutoresizing.All, ContentMode = UIViewContentMode.ScaleToFill }; pageControl.ValueChanged += PageControlValueChanged; scroller = new UIScrollView { AutoresizingMask = UIViewAutoresizing.All, ContentMode = UIViewContentMode.ScaleToFill, PagingEnabled = true, Bounces = false, ShowsHorizontalScrollIndicator = false, ShowsVerticalScrollIndicator = false }; scroller.Scrolled += ScrollChanged; NSNotificationCenter.DefaultCenter.AddObserver ( UIApplication.DidChangeStatusBarOrientationNotification, not => { var orientation = UIDevice.CurrentDevice.Orientation; if ((UIDeviceOrientation.LandscapeLeft == orientation || UIDeviceOrientation.LandscapeRight == orientation)) { scroller.ContentSize = new CGSize (Frame.Height * images.Count - 1, Frame.Width); } else { scroller.ContentSize = new CGSize (Frame.Width * images.Count - 1, Frame.Height); } UpdateScrollPositionBasedOnPageControl (); }); Add (scroller); Add (pageControl); }
public FeaturedCell(NSString cellId) : base(UITableViewCellStyle.Default, cellId) { SelectionStyle = UITableViewCellSelectionStyle.None; articles = new FeaturedArticle[4]; scrollView = new UIScrollView (); pageControl = new UIPageControl (); for (int i = 0; i < 4; i++) { articles [i] = new FeaturedArticle (); scrollView.AddSubview (articles [i].Article); } scrollView.PagingEnabled = true; scrollView.ShowsHorizontalScrollIndicator = false; ContentView.AddSubview (scrollView); ContentView.AddSubview (pageControl); }
public override void ViewDidLoad() { base.ViewDidLoad (); scrollView = new UIScrollView (new RectangleF (0, 0, 320, 460)); scrollView.BackgroundColor = UIColor.Blue; this.View.AddSubview (scrollView); pageControl = new UIPageControl (new RectangleF (0, 460, 320, 20)); pageControl.BackgroundColor = UIColor.Red; this.View.AddSubview (pageControl); // We've now defined our layout, to actually use it we simply create a UILayoutHost control and pass it the layout this.View = new XibFree.UILayoutHost (layout); this.View.BackgroundColor = UIColor.Gray; LoadControllers (); // Perform any additional setup after loading the view, typically from a nib. }
public NavLauncher() : base() { var mainFrame = this.View.Bounds; // Navbar mainFrame.Height -= 44; MainView = new UIView (mainFrame); var scrollRect = MainView.Frame; scrollRect.Height -= pageControlH; scrollView = new UIScrollView (scrollRect); scrollView.ShowsHorizontalScrollIndicator = false; scrollView.ShowsVerticalScrollIndicator = false; scrollView.Scrolled += ScrollViewScrolled; scrollView.PagingEnabled = true; var pageRect = new RectangleF (0, scrollRect.Height, scrollRect.Width, pageControlH); pageControl = new UIPageControl (pageRect); pageControl.BackgroundColor = UIColor.Black; pageControl.TouchUpInside += HandlePageControlTouchUpInside; this.View.AddSubview (MainView); MainView.AddSubview (scrollView); MainView.AddSubview (pageControl); //scrollView.BackgroundColor = UIColor.Gray; }
private void BtnPageControl_TouchUpInside(object sender,EventArgs e) { //UIScrollView this.pageScrollView = new UIScrollView (); this.pageScrollView.Frame = new CoreGraphics.CGRect (750, 610, 260, 100); this.pageScrollView.PagingEnabled = true; CoreGraphics.CGRect pageFrame = this.pageScrollView.Frame; this.pageScrollView.ContentSize = new CoreGraphics.CGSize (pageFrame.Width * 2, pageFrame.Height); this.pageScrollView.DecelerationEnded += PageScrollView_DecelerationEnded; //UIPageControl this.pageControl = new UIPageControl (); this.pageControl.Frame = new CoreGraphics.CGRect (750, 740, 260, 20); this.pageControl.Pages = 2; this.pageControl.BackgroundColor = UIColor.Gray; this.pageControl.ValueChanged += PageControl_ValueChanged; imgva = new UIImageView (new CoreGraphics.CGRect (0, 0, 260, 100)); imgva.Image = UIImage.FromFile ("imgstyle.png"); imgva.ContentMode = UIViewContentMode.ScaleAspectFit; pageFrame.X += this.pageScrollView.Frame.Width; imgvb=new UIImageView(new CoreGraphics.CGRect (260, 0, 260, 100)); imgvb.Image = UIImage.FromFile ("556a69d05ddd1.jpg"); imgvb.ContentMode = UIViewContentMode.ScaleAspectFit; this.pageScrollView.AddSubview (imgva); this.pageScrollView.AddSubview (imgvb); this.View.AddSubview (this.pageScrollView); this.View.AddSubview(this.pageControl); }
public void Include(UIPageControl pageControl) { pageControl.Pages = pageControl.Pages + 1; pageControl.ValueChanged += (sender, args) => { pageControl.Pages = 0; }; pageControl.WeakSubscribe(nameof(pageControl.ValueChanged), null); }
protected override void SetupSubviews() { base.SetupSubviews(); BackgroundColor = Theme.Colors.ScreenBackground; CollectionView = new UICollectionView( CGRect.Empty, new UICollectionViewFlowLayout { ScrollDirection = UICollectionViewScrollDirection.Horizontal, ItemSize = new CGSize(UIScreen.MainScreen.Bounds.Width, CollectionHeight), MinimumLineSpacing = 0, MinimumInteritemSpacing = 0 }) { PagingEnabled = true, BackgroundColor = Theme.Colors.ScreenBackground, ShowsHorizontalScrollIndicator = false }; CollectionView.RegisterClassForCell(typeof(DetailsItemCollectionViewCell), DetailsItemCollectionViewCell.CellId); _topDevider = new UIView { BackgroundColor = Theme.Colors.Accent }; _bottomDevider = new UIView { BackgroundColor = Theme.Colors.Accent }; StartDateControlView = new DateControlView { TextColor = Theme.Colors.Accent }; EndDateControlView = new DateControlView { TextColor = Theme.Colors.Green }; PageControl = new UIPageControl { CurrentPageIndicatorTintColor = Theme.Colors.Accent, PageIndicatorTintColor = Theme.Colors.Gray, UserInteractionEnabled = false }; StateSegmentedControl = new UISegmentedControl() { SelectedSegmentTintColor = Theme.Colors.Green }; StateSegmentedControl.SetTitleTextAttributes( new UITextAttributes { TextColor = Theme.Colors.Gray }, UIControlState.Normal); StateSegmentedControl.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White }, UIControlState.Selected); StateSegmentedControl.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White }, UIControlState.Highlighted); }
protected override void OnElementChanged(ElementChangedEventArgs <CarouselViewControl> e) { base.OnElementChanged(e); if (Control == null) { // Instantiate the native control and assign it to the Control property with // the SetNativeControl method var interPageSpacing = (float)Element.InterPageSpacing; var orientation = (UIPageViewControllerNavigationOrientation)Element.Orientation; pageController = new UIPageViewController(UIPageViewControllerTransitionStyle.Scroll, orientation, UIPageViewControllerSpineLocation.None, interPageSpacing); if (Element.PageIndicators) { //pageController.GetPresentationCount = (p) => Element.ItemsSource.Count; //pageController.GetPresentationIndex = (p) => Element.Position; pageControl = new UIPageControl(); pageControl.PageIndicatorTintColor = Element.PageIndicatorTintColor.ToUIColor(); pageControl.CurrentPageIndicatorTintColor = Element.CurrentPageIndicatorTintColor.ToUIColor(); pageControl.TranslatesAutoresizingMaskIntoConstraints = false; ConfigurePageControl(); // TODO: add pageControl to UIView, background color to UIView, add UIView to superview and apply constraints if (Element.Orientation == Orientation.Horizontal) { var appearance = UIPageControl.Appearance; appearance.BackgroundColor = Element.PageIndicatorBackgroundColor.ToUIColor(); pageController.View.AddSubview(pageControl); var viewsDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { pageControl }, new NSObject[] { new NSString("pageControl") }); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[pageControl]|", NSLayoutFormatOptions.AlignAllCenterX, new NSDictionary(), viewsDictionary)); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:[pageControl]|", 0, new NSDictionary(), viewsDictionary)); } else { pageControl.Transform = CGAffineTransform.MakeRotation(3.14159265f / 2); var container = new UIView(); container.TranslatesAutoresizingMaskIntoConstraints = false; container.BackgroundColor = Element.PageIndicatorBackgroundColor.ToUIColor(); container.AddSubview(pageControl); pageController.View.AddSubview(container); var viewsDictionary1 = NSDictionary.FromObjectsAndKeys(new NSObject[] { container }, new NSObject[] { new NSString("container") }); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("[container(==36)]", 0, new NSDictionary(), viewsDictionary1)); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:[container]|", 0, new NSDictionary(), viewsDictionary1)); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[container]|", NSLayoutFormatOptions.AlignAllCenterY, new NSDictionary(), viewsDictionary1)); var viewsDictionary2 = NSDictionary.FromObjectsAndKeys(new NSObject[] { pageControl }, new NSObject[] { new NSString("pageControl") }); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("[pageControl(==36)]", 0, new NSDictionary(), viewsDictionary2)); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:[pageControl]|", 0, new NSDictionary(), viewsDictionary2)); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[pageControl]|", NSLayoutFormatOptions.AlignAllCenterY, new NSDictionary(), viewsDictionary2)); } } SetNativeControl(pageController.View); } if (e.OldElement != null) { // Unsubscribe from event handlers and cleanup any resources if (pageController != null) { pageController.GetPresentationCount = null; pageController.GetPresentationIndex = null; pageController.DidFinishAnimating -= PageController_DidFinishAnimating; pageController.GetPreviousViewController = null; pageController.GetNextViewController = null; } if (Element != null) { Element.ItemsSourceChanged = null; Element.RemoveAction = null; Element.InsertAction = null; Element.SetCurrentAction = null; } } if (e.NewElement != null) { // Configure the control and subscribe to event handlers foreach (var view in pageController.View.Subviews) { var scroller = view as UIScrollView; if (scroller != null) { scroller.Bounces = Element.Bounces; } /*if (Element.PageIndicators) * { * var pageControl = view as UIPageControl; * if (pageControl != null) * { * pageController.View.BackgroundColor = Color.Teal.ToUIColor(); * //var appearance = UIPageControl.Appearance; * //appearance.BackgroundColor = Element.PageIndicatorBackgroundColor.ToUIColor(); * pageControl.BackgroundColor = Element.PageIndicatorBackgroundColor.ToUIColor(); * pageControl.PageIndicatorTintColor = Element.PageIndicatorTintColor.ToUIColor(); * pageControl.CurrentPageIndicatorTintColor = Element.CurrentPageIndicatorTintColor.ToUIColor(); * } * }*/ } pageController.DidFinishAnimating += PageController_DidFinishAnimating; pageController.GetPreviousViewController = (pageViewController, referenceViewController) => { var controller = (ViewContainer)referenceViewController; var position = controller.Tag; // Determine if we are on the first page if (position == 0) { // We are on the first page, so there is no need for a controller before that return(null); } else { int previousPageIndex = position - 1; return(CreateViewController(previousPageIndex)); } }; pageController.GetNextViewController = (pageViewController, referenceViewController) => { var controller = (ViewContainer)referenceViewController; var position = controller.Tag; // Determine if we are on the last page if (position == Count - 1) { // We are on the last page, so there is no need for a controller after that return(null); } else { int nextPageIndex = position + 1; return(CreateViewController(nextPageIndex)); } }; Element.ItemsSourceChanged = new Action(ItemsSourceChanged); Element.RemoveAction = new Action <int>(RemoveController); Element.InsertAction = new Action <object, int>(InsertController); Element.SetCurrentAction = new Action <int>(SetCurrentController); /*if (Element.ItemsSource is INotifyCollectionChanged) * { * var collection = Element.ItemsSource as INotifyCollectionChanged; * }*/ } }
public override void ViewDidLoad() { base.ViewDidLoad(); var space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var btnClose = new UIBarButtonItem(); btnClose.Image = UIImage.FromFile("close.png"); btnClose.Clicked += delegate { DismissViewController(true, null); }; var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextColor = UIColor.White; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.Text = "Thumbs".t(); var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBar.BarStyle = UIBarStyle.Black; toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBar.SetItems(new [] { space, btnClose }, false); toolBar.AddSubview(toolBarTitle); View.AddSubview(toolBar); _thumbsViewContainer = new UIView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height - 85)); _thumbsViewContainer.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; _thumbsViewContainer.BackgroundColor = UIColor.Gray; View.AddSubview(_thumbsViewContainer); _thumbsPageControl = new UIPageControl(new RectangleF(0, View.Bounds.Height - 30, View.Bounds.Width, 20)); _thumbsPageControl.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; _thumbsPageControl.ValueChanged += delegate { createThumbsPage(_thumbsPageControl.CurrentPage); }; View.AddSubview(_thumbsPageControl); }
protected override void OnElementChanged(VisualElementChangedEventArgs e) { base.OnElementChanged(e); _pagedCarouselPage = (CxPagedCarouselPage)e.NewElement; _view = NativeView; _uiPageControl = new UIPageControl(); SetPageIndicatorTintColor(); SetCurrentPageIndicatorTintColor(); _view.Add(_uiPageControl); _pagedCarouselPage.PropertyChanged += OnPagedCarouselPagePropertyChanged; _uiPageControl.ValueChanged += OnUIPageControlValueChanged; }
public UIPageControl GetIntroductionProgressView(int CurrentPage) { int ywidth = 330; if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) { //iOS 8 ywidth = 75; } var pageControl = new UIPageControl { Pages = 2, Frame = new CGRect ( _authentication.View.Frame.Width / 2 - 50, //X _authentication.View.Frame.Height - ywidth, //Y 100, //Width 50) //Height }; pageControl.Enabled = false; pageControl.CurrentPage = CurrentPage; return pageControl; }
public static void UpdateCurrentPagesIndicatorTintColor(this UIPageControl pageControl, IIndicatorView indicatorView) => pageControl.CurrentPageIndicatorTintColor = indicatorView.SelectedIndicatorColor?.ToColor()?.ToPlatform();
protected override void OnElementChanged(ElementChangedEventArgs <CarouselViewControl> e) { base.OnElementChanged(e); if (Control == null) { // Instantiate the native control and assign it to the Control property with // the SetNativeControl method nativeView = new UIView(); nativeView.ClipsToBounds = true; var interPageSpacing = (float)Element.InterPageSpacing; var orientation = (UIPageViewControllerNavigationOrientation)Element.Orientation; pageController = new UIPageViewController(UIPageViewControllerTransitionStyle.Scroll, orientation, UIPageViewControllerSpineLocation.None, interPageSpacing); nativeView.AddSubview(pageController.View); pageControl = new UIPageControl(); pageControl.PageIndicatorTintColor = Element.PageIndicatorTintColor.ToUIColor(); pageControl.CurrentPageIndicatorTintColor = Element.CurrentPageIndicatorTintColor.ToUIColor(); pageControl.TranslatesAutoresizingMaskIntoConstraints = false; pageControl.Enabled = false; ConfigurePageControl(); nativeView.AddSubview(pageControl); var viewsDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { pageControl }, new NSObject[] { new NSString("pageControl") }); if (Element.Orientation == Orientation.Horizontal) { nativeView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[pageControl]|", NSLayoutFormatOptions.AlignAllCenterX, new NSDictionary(), viewsDictionary)); nativeView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:[pageControl]|", 0, new NSDictionary(), viewsDictionary)); } else { pageControl.Transform = CGAffineTransform.MakeRotation(3.14159265f / 2); nativeView.AddConstraints(NSLayoutConstraint.FromVisualFormat("[pageControl(==36)]", 0, new NSDictionary(), viewsDictionary)); nativeView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:[pageControl]|", 0, new NSDictionary(), viewsDictionary)); nativeView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[pageControl]|", NSLayoutFormatOptions.AlignAllTop, new NSDictionary(), viewsDictionary)); } pageControl.Hidden = !Element.ShowIndicators; foreach (var view in pageController.View.Subviews) { var scroller = view as UIScrollView; if (scroller != null) { scroller.Bounces = Element.Bounces; } } SetNativeControl(nativeView); } if (e.OldElement != null) { // Unsubscribe from event handlers and cleanup any resources if (pageController != null) { pageController.GetPresentationCount = null; pageController.GetPresentationIndex = null; pageController.DidFinishAnimating -= PageController_DidFinishAnimating; pageController.GetPreviousViewController = null; pageController.GetNextViewController = null; } if (Element != null) { Element.RemoveAction = null; Element.InsertAction = null; Element.SetCurrentAction = null; } } if (e.NewElement != null) { // Configure the control and subscribe to event handlers pageController.DidFinishAnimating += PageController_DidFinishAnimating; pageController.GetPreviousViewController = (pageViewController, referenceViewController) => { var controller = (ViewContainer)referenceViewController; var position = controller.Tag; // Determine if we are on the first page if (position == 0) { // We are on the first page, so there is no need for a controller before that return(null); } else { int previousPageIndex = position - 1; return(CreateViewController(previousPageIndex)); } }; pageController.GetNextViewController = (pageViewController, referenceViewController) => { var controller = (ViewContainer)referenceViewController; var position = controller.Tag; // Determine if we are on the last page if (position == Count - 1) { // We are on the last page, so there is no need for a controller after that return(null); } else { int nextPageIndex = position + 1; return(CreateViewController(nextPageIndex)); } }; Element.RemoveAction = new Action <int>(RemoveController); Element.InsertAction = new Action <object, int>(InsertController); Element.SetCurrentAction = new Action <int>(SetCurrentController); } }
public static void UpdatePages(this UIPageControl pageControl, int pageCount) => pageControl.Pages = pageCount;
public static void UpdatePagesIndicatorTintColor(this UIPageControl pageControl, IIndicatorView indicatorView) => pageControl.PageIndicatorTintColor = indicatorView.IndicatorColor?.ToColor()?.ToPlatform();
public static void UpdateCurrentPage(this UIPageControl pageControl, int currentPage) => pageControl.CurrentPage = currentPage;
public static void UpdateHideSingle(this UIPageControl pageControl, IIndicatorView indicatorView) => pageControl.HidesForSinglePage = indicatorView.HideSingle;
public FeedCellBuilder(UIView contentView) { _contentView = contentView; _moreButton = new UIButton(); _moreButton.Frame = new CGRect(_contentView.Frame.Width - moreButtonWidth, 0, moreButtonWidth, likeButtonWidthConst); _moreButton.SetImage(UIImage.FromBundle("ic_more"), UIControlState.Normal); //_moreButton.BackgroundColor = UIColor.Black; _contentView.AddSubview(_moreButton); _avatarImage = new UIImageView(new CGRect(leftMargin, 20, 30, 30)); _contentView.AddSubview(_avatarImage); var authorX = _avatarImage.Frame.Right + 10; _author = new UILabel(new CGRect(authorX, _avatarImage.Frame.Top - 2, _moreButton.Frame.Left - authorX, 18)); _author.Font = Constants.Semibold14; //_author.BackgroundColor = UIColor.Yellow; _author.LineBreakMode = UILineBreakMode.TailTruncation; _author.TextColor = Constants.R15G24B30; _contentView.AddSubview(_author); _timestamp = new UILabel(new CGRect(authorX, _author.Frame.Bottom, _moreButton.Frame.Left - authorX, 16)); _timestamp.Font = Constants.Regular12; //_timestamp.BackgroundColor = UIColor.Green; _timestamp.LineBreakMode = UILineBreakMode.TailTruncation; _timestamp.TextColor = Constants.R151G155B158; _contentView.AddSubview(_timestamp); _photoScroll = new UIScrollView(); _photoScroll.ShowsHorizontalScrollIndicator = false; _photoScroll.Bounces = false; _photoScroll.PagingEnabled = true; _photoScroll.Scrolled += (sender, e) => { var pageWidth = _photoScroll.Frame.Size.Width; _pageControl.CurrentPage = (int)Math.Floor((_photoScroll.ContentOffset.X - pageWidth / 2) / pageWidth) + 1; }; contentView.AddSubview(_photoScroll); _pageControl = new UIPageControl(); _pageControl.Hidden = true; _pageControl.UserInteractionEnabled = false; contentView.AddSubview(_pageControl); _likes = new UILabel(); _likes.Font = Constants.Semibold14; _likes.LineBreakMode = UILineBreakMode.TailTruncation; _likes.TextColor = Constants.R15G24B30; _likes.UserInteractionEnabled = true; _contentView.AddSubview(_likes); _flags = new UILabel(); _flags.Font = Constants.Semibold14; //_flags.BackgroundColor = UIColor.Orange; _flags.LineBreakMode = UILineBreakMode.TailTruncation; _flags.TextColor = Constants.R15G24B30; _flags.UserInteractionEnabled = true; _contentView.AddSubview(_flags); _rewards = new UILabel(); _rewards.Font = Constants.Semibold14; //_rewards.BackgroundColor = UIColor.Orange; _rewards.LineBreakMode = UILineBreakMode.TailTruncation; _rewards.TextColor = Constants.R15G24B30; _rewards.UserInteractionEnabled = true; _contentView.AddSubview(_rewards); _like = new UIImageView(); _like.ContentMode = UIViewContentMode.Center; _contentView.AddSubview(_like); _verticalSeparator = new UIView(); _verticalSeparator.BackgroundColor = Constants.R244G244B246; _contentView.AddSubview(_verticalSeparator); _topSeparator = new UIView(); _topSeparator.BackgroundColor = Constants.R244G244B246; _contentView.AddSubview(_topSeparator); var _noLinkAttribute = new UIStringAttributes { Font = Constants.Regular14, ForegroundColor = Constants.R151G155B158, }; var at = new NSMutableAttributedString(); at.Append(new NSAttributedString("...", _noLinkAttribute)); _attributedLabel = new TTTAttributedLabel(); _attributedLabel.EnabledTextCheckingTypes = NSTextCheckingType.Link; var prop = new NSDictionary(); _attributedLabel.LinkAttributes = prop; _attributedLabel.ActiveLinkAttributes = prop; _attributedLabel.Font = Constants.Regular14; _attributedLabel.Lines = 3; _attributedLabel.UserInteractionEnabled = true; _attributedLabel.Enabled = true; _attributedLabel.AttributedTruncationToken = at; //_attributedLabel.BackgroundColor = UIColor.Blue; _contentView.AddSubview(_attributedLabel); _comments = new UILabel(); _comments.Font = Constants.Regular14; //_comments.BackgroundColor = UIColor.DarkGray; _comments.LineBreakMode = UILineBreakMode.TailTruncation; _comments.TextColor = Constants.R151G155B158; _comments.UserInteractionEnabled = true; _comments.TextAlignment = UITextAlignment.Center; _contentView.AddSubview(_comments); _bottomSeparator = new UIView(); _bottomSeparator.BackgroundColor = Constants.R244G244B246; _contentView.AddSubview(_bottomSeparator); _profileTapView = new UIView(new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width / 2, likeButtonWidthConst)); _profileTapView.UserInteractionEnabled = true; _contentView.AddSubview(_profileTapView); _likersTapView = new UIView(); _likersTapView.UserInteractionEnabled = true; _contentView.AddSubview(_likersTapView); likersY = underPhotoPanelHeight / 2 - likersImageSide / 2; likersCornerRadius = likersImageSide / 2; var liketap = new UITapGestureRecognizer(LikeTap); _like.AddGestureRecognizer(liketap); _sliderView = new SliderView(UIScreen.MainScreen.Bounds.Width); _sliderView.LikeTap += () => { LikeTap(); }; BaseViewController.SliderAction += (isSliderOpening) => { if (_sliderView.Superview != null && !isSliderOpening) { _sliderView.Close(); } }; var likelongtap = new UILongPressGestureRecognizer((UILongPressGestureRecognizer obj) => { if (AppSettings.User.IsAuthenticated && !_currentPost.Vote) { if (obj.State == UIGestureRecognizerState.Began) { if (!BasePostPresenter.IsEnableVote || BaseViewController.IsSliderOpen) { return; } BaseViewController.IsSliderOpen = true; _sliderView.Show(_contentView); } } }); _like.AddGestureRecognizer(likelongtap); UITapGestureRecognizer tap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Preview, _currentPost); }); _photoScroll.AddGestureRecognizer(tap); var profileTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Profile, _currentPost); }); var headerTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Profile, _currentPost); }); _profileTapView.AddGestureRecognizer(headerTap); _rewards.AddGestureRecognizer(profileTap); var commentTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Comments, _currentPost); }); _comments.AddGestureRecognizer(commentTap); var netVotesTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Voters, _currentPost); }); _likersTapView.AddGestureRecognizer(netVotesTap); var flagersTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Flagers, _currentPost); }); _flags.AddGestureRecognizer(flagersTap); _moreButton.TouchDown += FlagButton_TouchDown; }
public void Include(UIPageControl s) { s.Pages = s.Pages + 1; s.ValueChanged += (sender, args) => { s.Pages = 0; }; }
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); }
private void Initialize() { numberOfPages = 0; HidesForSinglePage = false; DefersCurrentPageDisplay = false; BackgroundColor = UIColor.Clear; measuredIndicatorWidth = DEFAULT_INDICATOR_WIDTH; measuredIndicatorHeight = DEFAULT_INDICATOR_WIDTH; indicatorDiameter = DEFAULT_INDICATOR_WIDTH; indicatorMargin = DEFAULT_INDICATOR_MARGIN; alignment = SMPageControlAlignment.Center; verticalAlignment = SMPageControlVerticalAlignment.Middle; IsAccessibilityElement = true; AccessibilityTraits = UIAccessibilityTrait.UpdatesFrequently; AccessibilityPageControl = new UIPageControl (); pageNames = new Dictionary<NSNumber,String> (); pageImages = new Dictionary<NSNumber,UIImage> (); currentPageImages = new Dictionary<NSNumber,UIImage> (); pageImageMasks = new Dictionary<NSNumber,UIImage> (); cgImageMasks = new Dictionary<NSNumber,CGImage> (); }
UIControl PageControl () { var page = new UIPageControl (new RectangleF (120f, 14f, 178f, 20f)){ BackgroundColor = UIColor.Gray, Pages = 10, Tag = kViewTag }; page.TouchUpInside += delegate { Console.WriteLine ("Current page: {0}", page.CurrentPage); }; return page; }
protected SliderFeedCollectionViewCell(IntPtr handle) : base(handle) { _contentView = ContentView; _closeButton = new UIButton(); _closeButton.Frame = new CGRect(_contentView.Frame.Width - moreButtonWidth, 0, moreButtonWidth, likeButtonWidthConst); _closeButton.SetImage(UIImage.FromBundle("ic_close_black"), UIControlState.Normal); //_closeButton.BackgroundColor = UIColor.Yellow; _contentView.AddSubview(_closeButton); _moreButton = new UIButton(); _moreButton.Frame = new CGRect(_closeButton.Frame.Left - moreButtonWidth, 0, moreButtonWidth, likeButtonWidthConst); _moreButton.SetImage(UIImage.FromBundle("ic_more"), UIControlState.Normal); //_moreButton.BackgroundColor = UIColor.Black; _contentView.AddSubview(_moreButton); _avatarImage = new UIImageView(); _avatarImage.Frame = new CGRect(leftMargin, 20, 30, 30); _contentView.AddSubview(_avatarImage); authorX = _avatarImage.Frame.Right + 10; _author = new UILabel(new CGRect(authorX, _avatarImage.Frame.Top - 2, _closeButton.Frame.Left - authorX, 18)); _author.Font = Constants.Semibold14; //_author.BackgroundColor = UIColor.Yellow; _author.LineBreakMode = UILineBreakMode.TailTruncation; _author.TextColor = Constants.R15G24B30; _contentView.AddSubview(_author); _timestamp = new UILabel(new CGRect(authorX, _author.Frame.Bottom, _closeButton.Frame.Left - authorX, 16)); _timestamp.Font = Constants.Regular12; //_timestamp.BackgroundColor = UIColor.Green; _timestamp.LineBreakMode = UILineBreakMode.TailTruncation; _timestamp.TextColor = Constants.R151G155B158; _contentView.AddSubview(_timestamp); _contentScroll = new UIScrollView(); _contentScroll.Frame = new CGRect(0, _avatarImage.Frame.Bottom + 20, _contentView.Frame.Width, _contentView.Frame.Height - (_avatarImage.Frame.Bottom + 20)); _contentScroll.ShowsVerticalScrollIndicator = false; _contentScroll.Bounces = false; //_contentScroll.BackgroundColor = UIColor.LightGray; _contentView.AddSubview(_contentScroll); _photoScroll = new UIScrollView(); _photoScroll.ShowsHorizontalScrollIndicator = false; _photoScroll.Bounces = false; _photoScroll.PagingEnabled = true; _photoScroll.Scrolled += (sender, e) => { var pageWidth = _photoScroll.Frame.Size.Width; _pageControl.CurrentPage = (int)Math.Floor((_photoScroll.ContentOffset.X - pageWidth / 2) / pageWidth) + 1; }; _photoScroll.Layer.CornerRadius = 10; _contentScroll.AddSubview(_photoScroll); _pageControl = new UIPageControl(); _pageControl.Hidden = true; _pageControl.UserInteractionEnabled = false; _contentScroll.AddSubview(_pageControl); _likes = new UILabel(); _likes.Font = Constants.Semibold14; _likes.LineBreakMode = UILineBreakMode.TailTruncation; _likes.TextColor = Constants.R15G24B30; _likes.UserInteractionEnabled = true; _contentScroll.AddSubview(_likes); //_likes.BackgroundColor = UIColor.Purple; _flags = new UILabel(); _flags.Font = Constants.Semibold14; //_flags.BackgroundColor = UIColor.Orange; _flags.LineBreakMode = UILineBreakMode.TailTruncation; _flags.TextColor = Constants.R15G24B30; _flags.UserInteractionEnabled = true; _contentScroll.AddSubview(_flags); _rewards = new UILabel(); _rewards.Font = Constants.Semibold14; //_rewards.BackgroundColor = UIColor.Orange; _rewards.LineBreakMode = UILineBreakMode.TailTruncation; _rewards.TextColor = Constants.R15G24B30; _rewards.UserInteractionEnabled = true; _contentScroll.AddSubview(_rewards); _like = new UIImageView(); _like.ContentMode = UIViewContentMode.Center; //_like.BackgroundColor = UIColor.Orange; _contentScroll.AddSubview(_like); _verticalSeparator = new UIView(); _verticalSeparator.BackgroundColor = Constants.R244G244B246; _contentScroll.AddSubview(_verticalSeparator); _topSeparator = new UIView(); _topSeparator.BackgroundColor = Constants.R244G244B246; _contentScroll.AddSubview(_topSeparator); _comments = new UILabel(); _comments.Font = Constants.Regular14; //_comments.BackgroundColor = UIColor.DarkGray; _comments.LineBreakMode = UILineBreakMode.TailTruncation; _comments.TextColor = Constants.R151G155B158; _comments.UserInteractionEnabled = true; _comments.TextAlignment = UITextAlignment.Center; _contentScroll.AddSubview(_comments); _bottomSeparator = new UIView(); _bottomSeparator.BackgroundColor = Constants.R244G244B246; _contentScroll.AddSubview(_bottomSeparator); _profileTapView = new UIView(new CGRect(0, 0, _contentView.Frame.Width / 2, likeButtonWidthConst)); _profileTapView.UserInteractionEnabled = true; _contentView.AddSubview(_profileTapView); _likersTapView = new UIView(); _likersTapView.UserInteractionEnabled = true; _contentScroll.AddSubview(_likersTapView); likersY = underPhotoPanelHeight / 2 - likersImageSide / 2; likersCornerRadius = likersImageSide / 2; var liketap = new UITapGestureRecognizer(LikeTap); _like.AddGestureRecognizer(liketap); _sliderView = new SliderView(_contentScroll.Frame.Width); _sliderView.LikeTap += () => { LikeTap(); }; BaseViewController.SliderAction += (isOpening) => { if (_sliderView.Superview != null && !isOpening) { _sliderView.Close(); } }; var likelongtap = new UILongPressGestureRecognizer((UILongPressGestureRecognizer obj) => { if (AppSettings.User.HasPostingPermission && !_currentPost.Vote) { if (obj.State == UIGestureRecognizerState.Began) { if (!BasePostPresenter.IsEnableVote) { return; } BaseViewController.IsSliderOpen = true; _sliderView.Show(_contentScroll); } } }); _like.AddGestureRecognizer(likelongtap); UITapGestureRecognizer tap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Preview, _currentPost); }); _photoScroll.AddGestureRecognizer(tap); var profileTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Profile, _currentPost); }); var headerTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Profile, _currentPost); }); _profileTapView.AddGestureRecognizer(headerTap); _rewards.AddGestureRecognizer(profileTap); var commentTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Comments, _currentPost); }); _comments.AddGestureRecognizer(commentTap); var netVotesTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Voters, _currentPost); }); _likersTapView.AddGestureRecognizer(netVotesTap); var flagersTap = new UITapGestureRecognizer(() => { CellAction?.Invoke(ActionType.Flagers, _currentPost); }); _flags.AddGestureRecognizer(flagersTap); _moreButton.TouchDown += FlagButton_TouchDown; _closeButton.TouchDown += Close_TouchDown; }
public override void ViewDidLoad() { base.ViewDidLoad(); var backgroundImageView = new UIImageView { Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height), Image = UIImage.FromBundle("TutorialBackground") }; pageImages = new List <string> { "TutorialPage1", "TutorialPage2", "TutorialPage3", "TutorialPage4" }; pageViewController = this.Storyboard.InstantiateViewController("PageViewController") as UIPageViewController; pageViewController.DataSource = new TutorialPageViewControllerDataSource(this, pageImages); var startVC = this.ViewControllerAtIndex(0) as TutorialContentPageViewController; var viewControllers = new UIViewController[] { startVC }; pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, true, null); // Set appearance of buttons and page control on TutorialViewController int buttonHeight = 39; int buttonSpace = 20; var logInTutorialButton = new UIButton() { Frame = new CGRect(buttonSpace, UIScreen.MainScreen.Bounds.Size.Height - buttonHeight - buttonSpace, UIScreen.MainScreen.Bounds.Size.Width / 2 - buttonSpace - buttonSpace / 2, buttonHeight), }; logInTutorialButton.SetTitle("Log In", UIControlState.Normal); logInTutorialButton.TitleLabel.Font = UIFont.SystemFontOfSize(16); logInTutorialButton.Layer.BorderWidth = 0.5f; logInTutorialButton.Layer.CornerRadius = 5; logInTutorialButton.Layer.BorderColor = UIColor.DarkGray.CGColor; logInTutorialButton.SetTitleColor(UIColor.White, UIControlState.Normal); logInTutorialButton.SetTitleColor(UIColor.FromWhiteAlpha(0.8f, 0.2f), UIControlState.Highlighted); var signUpTutorialButton = new UIButton() { Frame = new CGRect(logInTutorialButton.Layer.Frame.GetMaxX() + buttonSpace, UIScreen.MainScreen.Bounds.Size.Height - buttonHeight - buttonSpace, UIScreen.MainScreen.Bounds.Size.Width / 2 - buttonSpace - buttonSpace / 2, buttonHeight), }; signUpTutorialButton.SetTitle("Sign Up", UIControlState.Normal); signUpTutorialButton.TitleLabel.Font = UIFont.SystemFontOfSize(16); signUpTutorialButton.Layer.BorderWidth = 0.5f; signUpTutorialButton.Layer.CornerRadius = 5; signUpTutorialButton.Layer.BorderColor = UIColor.DarkGray.CGColor; signUpTutorialButton.SetTitleColor(UIColor.FromRGB(214, 93, 98), UIControlState.Normal); signUpTutorialButton.SetTitleColor(UIColor.FromWhiteAlpha(0.8f, 0.2f), UIControlState.Highlighted); int pageControlWidth = 7; var tutorialPageControl = new UIPageControl() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Size.Width / 2 - pageControlWidth / 2, UIScreen.MainScreen.Bounds.Size.Height - buttonHeight - buttonSpace - 40, pageControlWidth, 0) }; tutorialPageControl.Pages = pageImages.Count(); tutorialPageControl.PageIndicatorTintColor = UIColor.White; tutorialPageControl.CurrentPageIndicatorTintColor = UIColor.FromRGB(214, 93, 98); tutorialPageControl.CurrentPage = 0; int nextPageButtonSize = 40; var nextPageTutorialButton = new UIButton() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Size.Width / 2 - nextPageButtonSize / 2, UIScreen.MainScreen.Bounds.Size.Height - buttonHeight - buttonSpace - 40 * 2 - nextPageButtonSize, nextPageButtonSize, nextPageButtonSize) }; nextPageTutorialButton.SetImage(UIImage.FromBundle("StartTutorialButton").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal); AddChildViewController(this.pageViewController); View.AddSubviews(backgroundImageView, this.pageViewController.View, nextPageTutorialButton, tutorialPageControl, signUpTutorialButton, logInTutorialButton); pageViewController.DidMoveToParentViewController(this); // Getting index of the current page to change pageControl pageViewController.DidFinishAnimating += delegate(object sender, UIPageViewFinishedAnimationEventArgs e) { if (e.Completed) { var currentVC = pageViewController.ViewControllers.First() as TutorialContentPageViewController; tutorialPageControl.CurrentPage = currentVC.pageIndex; if (currentVC.pageIndex == pageImages.Count() - 1) { nextPageTutorialButton.Hidden = true; } else { nextPageTutorialButton.Hidden = false; } } }; // Next Page button nextPageTutorialButton.TouchUpInside += (sender, e) => { var currentVC = pageViewController.ViewControllers.First() as TutorialContentPageViewController; var currentIndex = currentVC.pageIndex; if (currentIndex < pageImages.Count() - 1) { var nextVC = this.ViewControllerAtIndex(currentIndex + 1) as TutorialContentPageViewController; pageViewController.SetViewControllers(new UIViewController[] { nextVC }, UIPageViewControllerNavigationDirection.Forward, true, null); tutorialPageControl.CurrentPage = currentIndex + 1; // Hide button "next" on the last page if (currentIndex == pageImages.Count() - 2) { nextPageTutorialButton.Hidden = true; } } }; // Launch Login View Controller logInTutorialButton.TouchUpInside += (sender, e) => { var loginController = this.Storyboard.InstantiateViewController("LoginUserViewController") as LoginUserViewController; if (loginController != null) { this.PresentViewController(loginController, true, null); } }; // Launch Register View Controller signUpTutorialButton.TouchUpInside += (sender, e) => { var registerController = this.Storyboard.InstantiateViewController("EnterNameRegisterUser") as RegisterUserViewController; if (registerController != null) { var navigationController = new UINavigationController(registerController); this.PresentViewController(navigationController, true, null); } }; }
protected internal override void NativeInit() { if (this.Parent != null) { if (this.NativeUIElement == null) { var pageControl = new UIPageControl(); pageControl.HidesForSinglePage = true; pageControl.CurrentPageIndicatorTintColor = (Color)SelectedCircleColorProperty.DefaultMetadata.DefaultValue; pageControl.PageIndicatorTintColor = (Color)CircleColorProperty.DefaultMetadata.DefaultValue; pageControl.ValueChanged += this.PageControlValueChanged; this.NativeUIElement = pageControl; } } base.NativeInit(); }
public void Include(UIPageControl s) { s.Pages = s.Pages + 1; }
static UIControl PageControl (string id) { var page = new UIPageControl (new CGRect (120f, 14f, 178f, 20f)){ BackgroundColor = UIColor.Gray, Pages = 10, Tag = kViewTag, AccessibilityIdentifier = id }; page.TouchUpInside += delegate { Console.WriteLine ("Current page: {0}", page.CurrentPage); }; return page; }
protected override void Dispose(bool disposing) { if (disposing && scroller != null) { foreach (var subview in scroller.Subviews) { subview.Dispose (); } scroller.Scrolled -= ScrollChanged; scroller.Dispose (); scroller = null; pageControl.ValueChanged -= PageControlValueChanged; pageControl = null; images.CollectionChanged -= HandleCollectionChanged; images.Clear (); } base.Dispose (disposing); }
private void setScroll(float w, float h) { heightscroll = h - 45; //this.View.Bounds.Height; widthscroll = w; //this.View.Bounds.Width;; if (sramdom != null) { foreach (UIView v in sramdom) { v.RemoveFromSuperview(); v.Dispose(); } sramdom.RemoveFromSuperview(); sramdom.Dispose(); sramdom = null; } if (pageControl != null) { pageControl.RemoveFromSuperview(); pageControl.Dispose(); pageControl = null; } sramdom = new UIScrollView(new RectangleF(0, 0, widthscroll, heightscroll)); try { if (dataPos.galerias.Count <= 0) { UIImageView imgViewMainImage = new UIImageView(UIImage.FromFile("images/NOIMG.png")); imgViewMainImage.Frame = this.View.Frame; imgViewMainImage.ContentMode = UIViewContentMode.ScaleAspectFit; imgViewMainImage.UserInteractionEnabled = true; this.View.AddSubview(imgViewMainImage); return; } // UIImage image; var sw = this.View.Bounds.Width; //if (w == 1024) // w = 850; pageControl = new UIPageControl(new RectangleF(0, heightscroll - 100, w, 20)); pageControl.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; // vistaImagenes = new UIView (new RectangleF (0, 0, 320 , 367)); //MyScrollView = new UIScrollView (new RectangleF (0, 0,320 , 367)); //pageControl.BackgroundColor = UIColor.Gray;// .Clear ; RectangleF scrollFrame = sramdom.Frame; //MyScrollView.BackgroundColor =UIColor.Green ; //if (gal.Count <= 5) scrollFrame.Width = scrollFrame.Width * dataPos.galerias.Count; //else // scrollFrame.Width = scrollFrame.Width * 5; sramdom.Scrolled += delegate(object sender, EventArgs e) { try { double page = Math.Floor((sramdom.ContentOffset.X - sramdom.Frame.Width / 2) / sramdom.Frame.Width) + 1; pageControl.CurrentPage = (int)page; positionImg = (int)page; } catch { } }; pageControl.ValueChanged += delegate(object sender, EventArgs e) { var pc = (UIPageControl)sender; double fromPage = Math.Floor((sramdom.ContentOffset.X - sramdom.Frame.Width / 2) / sramdom.Frame.Width) + 1; var toPage = pc.CurrentPage; var pageOffset = sramdom.Frame.Width * toPage; if (fromPage > toPage) { pageOffset = sramdom.ContentOffset.X - sramdom.Frame.Width; } PointF p = new PointF(pageOffset, 0); sramdom.SetContentOffset(p, true); //btnaddItinerary.SetTitle ("+ Bookmark", UIControlState.Normal); }; pageControl.Hidden = false; pageControl.Pages = dataPos.galerias.Count; // else // pageControl.Pages = 5;//maximo 5 imagenes sramdom.BackgroundColor = base.headerColor; sramdom.PagingEnabled = true; sramdom.ContentSize = scrollFrame.Size; sramdom.ShowsHorizontalScrollIndicator = false; //sramdom.AutoresizingMask = UIViewAutoresizing.All; RectangleF frame = sramdom.Frame; frame.X = 0; int i = 0; foreach (galeriaImagenes g in dataPos.galerias) { System.Drawing.RectangleF Fr = new System.Drawing.RectangleF(frame.Width * i, 0, widthscroll, heightscroll); UIImageView imgViewMainImage = new UIImageView(); //(UIImage.FromFile("images/"+namebigPicture)); imgViewMainImage.Frame = Fr; imgViewMainImage.ContentMode = UIViewContentMode.ScaleAspectFill; // .ScaleToFill; imgViewMainImage.UserInteractionEnabled = true; imgViewMainImage.Tag = i; sramdom.InsertSubview(imgViewMainImage, 0); object[] on = new object[2]; on [0] = imgViewMainImage; on [1] = g; System.Threading.ThreadPool.QueueUserWorkItem(RequestImage, on); i++; } this.View.AddSubview(sramdom); this.View.AddSubview(pageControl); } catch { } }
public JacketCarouselDelegate(UIPageControl pageControl) { _pageControl = pageControl; }
void SetNativeView() { var interPageSpacing = (float)Element.InterPageSpacing; // Orientation BP var orientation = (UIPageViewControllerNavigationOrientation)Element.Orientation; // InterPageSpacing BP pageController = new UIPageViewController(UIPageViewControllerTransitionStyle.Scroll, orientation, UIPageViewControllerSpineLocation.None, interPageSpacing); Source = Element.ItemsSource != null ? new List <object>(Element.ItemsSource.GetList()) : null; // InterPageSpacingColor BP pageController.View.BackgroundColor = Element.InterPageSpacingColor.ToUIColor(); // IsSwipingEnabled BP SetIsSwipingEnabled(); // INDICATORS pageControl = new UIPageControl(); pageControl.TranslatesAutoresizingMaskIntoConstraints = false; pageControl.Enabled = false; pageController.View.AddSubview(pageControl); var viewsDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { pageControl }, new NSObject[] { new NSString("pageControl") }); if (Element.Orientation == CarouselViewOrientation.Horizontal) { pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[pageControl]|", NSLayoutFormatOptions.AlignAllCenterX, new NSDictionary(), viewsDictionary)); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:[pageControl]|", 0, new NSDictionary(), viewsDictionary)); } else { pageControl.Transform = CGAffineTransform.MakeRotation(3.14159265f / 2); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("[pageControl(==36)]", 0, new NSDictionary(), viewsDictionary)); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:[pageControl]|", 0, new NSDictionary(), viewsDictionary)); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[pageControl]|", NSLayoutFormatOptions.AlignAllTop, new NSDictionary(), viewsDictionary)); } #region adapter pageController.DidFinishAnimating += PageController_DidFinishAnimating; pageController.GetPreviousViewController = (pageViewController, referenceViewController) => { var controller = (ViewContainer)referenceViewController; if (controller != null) { var position = Source.IndexOf(controller.Tag); // Determine if we are on the first page if (position == 0) { // We are on the first page, so there is no need for a controller before that return(null); } else { int previousPageIndex = position - 1; return(CreateViewController(previousPageIndex)); } } else { return(null); } }; pageController.GetNextViewController = (pageViewController, referenceViewController) => { var controller = (ViewContainer)referenceViewController; if (controller != null) { var position = Source.IndexOf(controller.Tag); // Determine if we are on the last page if (position == Count - 1) { // We are on the last page, so there is no need for a controller after that return(null); } else { int nextPageIndex = position + 1; return(CreateViewController(nextPageIndex)); } } else { return(null); } }; #endregion if (Source != null && Source?.Count > 0) { var firstViewController = CreateViewController(Element.Position); pageController.SetViewControllers(new[] { firstViewController }, UIPageViewControllerNavigationDirection.Forward, false, s => { }); } SetNativeControl(pageController.View); }
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; }; }
public override void ViewDidLoad () { base.ViewDidLoad (); View.BackgroundColor = UIColor.Black; _pages = new List<UIView> (); _scroll = new UIScrollView { Frame = View.Frame, PagingEnabled = true, ContentSize = new SizeF ( _numPages * _pageWidth + _padding + 2 * _padding * (_numPages - 1), View.Frame.Height) }; View.AddSubview (_scroll); for (int i = 0; i < _numPages; i++) { UIView v = new UIView (); v.Add( new UILabel{ Frame = new RectangleF (100, 50, 100, 25), Text = String.Format("Page {0}", i+1)} ); _pages.Add (v); v.BackgroundColor = UIColor.Gray; v.Frame = new RectangleF ( i * + _pageWidth + _padding + (2 * _padding * i), 0, _pageWidth, _pageHeight); _scroll.AddSubview (v); } _scroll.Scrolled += delegate { _pager.CurrentPage = (int)Math.Round(_scroll.ContentOffset.X/_pageWidth); }; _pager = new UIPageControl(); _pager.Pages = _numPages; _pager.Frame = new RectangleF(0, 420, View.Frame.Width, 50); View.AddSubview(_pager); }
public PageDataSource(List <StartupPageFeatureViewController> pages, UIPageControl pageControl) { _pages = pages; _pageControl = pageControl; }
public UIPageControl AddPageControl(string name, UIColor backgroundColor) { var pageControl = new UIPageControl (); pageControl.BackgroundColor = backgroundColor; pageControl.Frame = DefaultFrame (); pageControl.TranslatesAutoresizingMaskIntoConstraints = false; OurConstraints.ViewNames.Add (new NSString (name)); OurConstraints.Views.Add (pageControl); this.Add (pageControl); return pageControl; }
public override void LoadView() { baseView = new UIView(UIScreen.MainScreen.Bounds); scrollView = new UIScrollView(new RectangleF(0,0,baseView.Bounds.Width,baseView.Bounds.Height-36)) { AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin, AutosizesSubviews = true, PagingEnabled = true, ShowsHorizontalScrollIndicator=false, ShowsVerticalScrollIndicator=false }; pageControl = new UIPageControl(new RectangleF(0,baseView.Bounds.Height-36,baseView.Bounds.Width,36)); pageControl.ValueChanged += delegate(object sender, EventArgs e) { var pc = (UIPageControl)sender; double fromPage = Math.Floor((scrollView.ContentOffset.X - scrollView.Frame.Width / 2) / scrollView.Frame.Width) + 1; var toPage = pc.CurrentPage; var pageOffset = scrollView.Frame.Width*toPage; Console.WriteLine("fromPage " + fromPage + " toPage " + toPage); PointF p = new PointF(pageOffset, 0); scrollView.SetContentOffset(p,true); }; CreatePanels(); baseView.AddSubview(scrollView); baseView.AddSubview(pageControl); View = baseView; }
public override void ViewDidLoad() { base.ViewDidLoad(); //this.ShowIntroWithCrossDissolve(); _pageTitles = new List <string> { "Explore", "Widget", "Navigation" }; _images = new List <string> { "screen1", "screen2", "screen3" }; //var pageController = UIPageControl.Appearance; //pageController.PageIndicatorTintColor = UIColor.Red; //pageController.CurrentPageIndicatorTintColor = UIColor.Red; //pageController.BackgroundColor = UIColor.DarkGray; pageViewController = this.Storyboard.InstantiateViewController("IntroPageViewController") as UIPageViewController; pageViewController.DataSource = new PageViewControllerDataSource(this, _pageTitles); var startVC = this.ViewControllerAtIndex(0) as IntroContentViewController; var viewControllers = new UIViewController[] { startVC }; pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null); pageViewController.View.Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Size.Height); AddChildViewController(this.pageViewController); View.AddSubview(this.pageViewController.View); pageViewController.DidMoveToParentViewController(this); var btnWidth = (this.View.Bounds.Width / 2) - 20; buttonSignUp = new UIButton(UIButtonType.Custom) { BackgroundColor = UIColor.Clear }; buttonSignUp.SetTitle("Sign Up", UIControlState.Normal); buttonSignUp.SetTitleColor(UIColor.White, UIControlState.Normal); buttonSignUp.Layer.BorderColor = UIColor.White.CGColor; buttonSignUp.Layer.BorderWidth = 1; buttonSignUp.Layer.CornerRadius = 2f; buttonSignUp.Frame = new CGRect(this.View.Bounds.GetMidX() - (btnWidth + 5), this.View.Bounds.GetMaxY() - 50, btnWidth, 30); buttonSignUp.TouchUpInside += Signup; this.View.AddSubview(buttonSignUp); buttonLogin = new UIButton(UIButtonType.Custom) { BackgroundColor = UIColor.Clear }; buttonLogin.SetTitle("Login", UIControlState.Normal); buttonLogin.SetTitleColor(UIColor.White, UIControlState.Normal); buttonLogin.Layer.BorderColor = UIColor.White.CGColor; buttonLogin.Layer.BorderWidth = 1; buttonLogin.Layer.CornerRadius = 2f; buttonLogin.Frame = new CGRect(this.View.Bounds.GetMidX() + 5, this.View.Bounds.GetMaxY() - 50, btnWidth, 30); buttonLogin.TouchUpInside += Login; this.View.AddSubview(buttonLogin); this.View.Layer.BackgroundColor = UIColor.Clear.CGColor; pageControl = new UIPageControl(new CGRect(this.View.Bounds.GetMidX() - 50, this.View.Bounds.GetMaxY() - 80, 100, 20)); pageControl.Pages = 3; pageControl.CurrentPage = 0; this.View.AddSubview(pageControl); }