private static void CreateContentScroll() { ContentScroll contentScrollPrefab = (ContentScroll)AssetDatabase.LoadAssetAtPath("Assets/Sticker Price/Prefabs/ContentScroll.prefab", typeof(ContentScroll)); ContentScroll newScroll = Instantiate <ContentScroll>(contentScrollPrefab); newScroll.transform.SetParent(Selection.activeGameObject.transform); }
void ScrollToIndex(int PageIndex) { CGRect Frameee = ContentScroll.Frame; Frameee.X = Frameee.Size.Width * PageIndex; Frameee.Y = 0; ContentScroll.ScrollRectToVisible(Frameee, true); }
void CreateScrollViews() { GetUserAnswers(); var PageeIndex = (nint)(ContentScroll.ContentOffset.X / ContentScroll.Frame.Width); WebService webService = new WebService(); var Donus = webService.OkuGetir("questions"); if (Donus != null) { QuestionDTOs = Newtonsoft.Json.JsonConvert.DeserializeObject <List <QuestionDTO> >(Donus.ToString()); QuestionDTOs = QuestionDTOs.FindAll(item => item.type != "CATEGORY_QUESTION"); CountLabel.Text = (PageeIndex + 1).ToString() + "/" + QuestionDTOs.Count.ToString(); } if (QuestionDTOs.Count > 0) { Noktalar = new UIViewController[QuestionDTOs.Count]; var b1 = ContentScroll.Frame.Width; for (int i = 0; i < QuestionDTOs.Count; i++) { if (QuestionDTOs[i].type == "MULTIPLE_CHOICE") { NoktaItem = this.Storyboard.InstantiateViewController("CoktanSecmeliSoruVC") as CoktanSecmeliSoruVC; (NoktaItem as CoktanSecmeliSoruVC).GelenSoru = QuestionDTOs[i]; (NoktaItem as CoktanSecmeliSoruVC).userAnswer = this.userAnswer; NoktaItem.View.Frame = new CoreGraphics.CGRect(0, 0, b1, ContentScroll.Frame.Height); } else if (QuestionDTOs[i].type == "OPEN_TIP") { NoktaItem = this.Storyboard.InstantiateViewController("RangeSoruVC") as RangeSoruVC; (NoktaItem as RangeSoruVC).GelenSoru = QuestionDTOs[i]; (NoktaItem as RangeSoruVC).userAnswer = this.userAnswer; NoktaItem.View.Frame = new CoreGraphics.CGRect(0, 0, b1, ContentScroll.Frame.Height); } if (i == 0) { NoktaItem.View.Frame = new CoreGraphics.CGRect(0, 0, b1, ContentScroll.Frame.Height); } else { NoktaItem.View.Frame = new CoreGraphics.CGRect(b1 * i, 0, b1, ContentScroll.Frame.Height); } NoktaItem.WillMoveToParentViewController(this); ContentScroll.AddSubview(NoktaItem.View); this.AddChildViewController(NoktaItem); NoktaItem.DidMoveToParentViewController(this); Noktalar[i] = NoktaItem; } CountLabel.Text = "1/" + Noktalar.Length; var RightPointt = Noktalar[Noktalar.Length - 1].View.Frame.Right; ContentScroll.ContentSize = new CoreGraphics.CGSize(RightPointt, ContentScroll.Frame.Height); ContentScroll.PagingEnabled = true; } else { CustomAlert.GetCustomAlert(this, "Henüz profil soruların hazır değil."); this.DismissViewController(true, null); } }
private void DataContextChangedEvent(FrameworkElement sender, DataContextChangedEventArgs args) { ContentScroll.ChangeView(0.0, 0.0, 1.0f); }
private void ContentText_TextChanged(object sender, TextChangedEventArgs e) { ContentScroll.ScrollToVerticalOffset(0); }