public override void LoadView() { var rect = UIScreen.MainScreen.Bounds; rect = CGAffineTransform.CGRectApplyAffineTransform (rect, CGAffineTransform.MakeRotation ((float)(90.0f * Math.PI / 180.0f))); rect.Location = PointF.Empty; this.View = new UIView (rect); this.View.BackgroundColor = UIColor.White; this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; rect = this.View.Bounds; rect.Height = 1000; _coverFlowDelegate = new CoverDelegate(); _coverFlowDataSource = new CoverDataSource(this); coverflow = new TKCoverflowView(this.View.Bounds); coverflow.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; coverflow.CoverflowDelegate = _coverFlowDelegate; coverflow.DataSource = _coverFlowDataSource; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { coverflow.CoverSpacing = 100; coverflow.CoverSize = new SizeF (300, 300); } this.View.AddSubview (coverflow); }
public override void LoadView() { var rect = UIScreen.MainScreen.Bounds; rect = CGAffineTransform.CGRectApplyAffineTransform(rect, CGAffineTransform.MakeRotation((float)(90.0f * Math.PI / 180.0f))); rect.Location = PointF.Empty; this.View = new UIView(rect); this.View.BackgroundColor = UIColor.White; this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; rect = this.View.Bounds; rect.Height = 1000; _coverFlowDelegate = new CoverDelegate(); _coverFlowDataSource = new CoverDataSource(this); coverflow = new TKCoverflowView(this.View.Bounds); coverflow.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; coverflow.CoverflowDelegate = _coverFlowDelegate; coverflow.DataSource = _coverFlowDataSource; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { coverflow.CoverSpacing = 100; coverflow.CoverSize = new SizeF(300, 300); } this.View.AddSubview(coverflow); }
public override void CoverAtIndexWasDoubleTapped(TKCoverflowView coverflowView, int index) { Console.WriteLine("Cover At Index {0} was Double Tapped", index); var cover = coverflowView.CoverAtIndex(index); if (cover == null) { return; } UIView.BeginAnimations("coverFlowViewTapAnimation"); UIView.SetAnimationDuration(1); UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromLeft, cover, true); UIView.CommitAnimations(); }
/// <summary> /// GetCover is just like GetCell on a UITableView DataSource. /// </summary> public override TKCoverflowCoverView GetCover(TKCoverflowView coverflowView, int index) { //---- try to dequeue a reusable cover TKCoverflowCoverView view = coverflowView.DequeueReusableCoverView(); //---- if we didn't get one, create a new one if (view == null) { view = new TKCoverflowCoverView(new RectangleF(0, 0, 244, 244)); view.Baseline = 224; } //---- set the image view.Image = this._coverImages[index]; //---- return the cover view return(view); }
public override TKCoverflowCoverView CoverflowViewcoverAtIndex(TKCoverflowView coverflowView, int index) { TKCoverflowCoverView cover = null; try{ cover = coverflowView.DequeueReusableCoverView(); }catch { } if (cover == null) { bool isPhone = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; var frame = isPhone ? new RectangleF(0, 0, 224, 300) : new RectangleF(0, 0, 300, 600); cover = new TKCoverflowCoverView(frame); cover.Baseline = 224; } var coverIndex = index % _viewController.Covers.Length; cover.Image = _viewController.Covers[coverIndex]; return(cover); }
//======================================================================== public CoverflowScreen() : base() { //---- create a new coverflow view control float statusBarHeight = UIApplication.SharedApplication.StatusBarFrame.Height; this._coverflow = new TKCoverflowView(new RectangleF(0, statusBarHeight , UIScreen.MainScreen.ApplicationFrame.Width, UIScreen.MainScreen.ApplicationFrame.Height - statusBarHeight)); //---- create the datasource for it List <UIImage> images = new List <UIImage>(); images.Add(UIImage.FromBundle("Images/Covers/Cover_DeathCabForCutie_PhotoAlbum_Resized.jpg")); images.Add(UIImage.FromBundle("Images/Covers/Cover_Earlimart_HymnAndHer_Resized.jpg")); images.Add(UIImage.FromBundle("Images/Covers/Cover_IronAndWine_WomanKing_Resized.jpg")); images.Add(UIImage.FromBundle("Images/Covers/Cover_MumfordAndSons_SighNoMore_Resized.jpg")); images.Add(UIImage.FromBundle("Images/Covers/Cover_Radiohead_OKComputer_Resized.jpg")); images.Add(UIImage.FromBundle("Images/Covers/Cover_Spiritualized_LadiesAndGentlemen_Resized.jpg")); images.Add(UIImage.FromBundle("Images/Covers/Cover_Stars_SetYourselfOnFire_Resized.jpg")); this._coverflowDataSource = new CoverFlowDataSource(images); //---- assign the datasource to the cover flow this._coverflow.DataSource = this._coverflowDataSource; this._coverflow.NumberOfCovers = images.Count; //---- wire up a handler for when a cover is brought to the front this._coverflow.CoverWasBroughtToFront += (object s, CoverflowEventArgs e) => { Console.WriteLine("Cover [" + e.Index.ToString() + "], brought to front"); }; //---- wire up a double tap handler this._coverflow.CoverWasDoubleTapped += (object s, CoverflowEventArgs e) => { new UIAlertView("Coverflow", "Cover [" + e.Index.ToString() + "] tapped.", null, "OK", null).Show(); }; this.View = this._coverflow; }
public override void CoverAtIndexWasDoubleTapped(TKCoverflowView coverflowView, int index) { Console.WriteLine("Cover At Index {0} was Double Tapped", index); var cover = coverflowView.CoverAtIndex(index); if(cover == null) return; UIView.BeginAnimations("coverFlowViewTapAnimation"); UIView.SetAnimationDuration(1); UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromLeft, cover, true); UIView.CommitAnimations(); }
public override void CoverAtIndexWasBroughtToFront(TKCoverflowView coverflowView, int index) { Console.WriteLine("Front " + index); }
public override TKCoverflowCoverView CoverflowViewcoverAtIndex(TKCoverflowView coverflowView, int index) { TKCoverflowCoverView cover = null; try{ cover = coverflowView.DequeueReusableCoverView(); }catch{ } if(cover == null) { bool isPhone = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; var frame = isPhone ? new RectangleF(0, 0, 224, 300) : new RectangleF(0, 0, 300, 600); cover = new TKCoverflowCoverView(frame); cover.Baseline = 224; } var coverIndex = index % _viewController.Covers.Length; cover.Image = _viewController.Covers[coverIndex]; return cover; }