示例#1
0
        /// <summary>
        /// Buttons the touch up inside.
        /// </summary>
        /// <returns>The touch up inside.</returns>
        void btnTouchUpInside(object sender, EventArgs e)
        {
            UIButton button = (UIButton)sender;

            //NYTPhotos list
            photos = new List <NYTPhoto>();

            var attrString = new NSAttributedString("The text",
                                                    strikethroughStyle: NSUnderlineStyle.Single);

            for (int i = 1; i < 31; i++)
            {
                if (i == 2)
                {
                    captionSummaryIndex = 1;
                }
                else
                {
                    captionSummaryIndex = 0;
                }

                var CaptionTitleAttrString = new NSAttributedString(i.ToString(),
                                                                    foregroundColor: UIColor.White, font: UIFont.BoldSystemFontOfSize(17));
                var CaptionSummaryAttrString = new NSAttributedString(captionSummary[captionSummaryIndex].ToString(),
                                                                      foregroundColor: UIColor.LightGray, font: UIFont.PreferredBody);
                var CaptionCreditAttrString = new NSAttributedString("NYT Xamarin iOS Binding Photo Credit: Jigar Maheshwari",
                                                                     foregroundColor: UIColor.Gray, font: UIFont.PreferredCaption1);

                string imageName = "cartoon" + i + ".jpg";
                photos.Add(new NYTPhoto()
                {
                    Image = UIImage.FromFile(imageName),
                    AttributedCaptionTitle   = CaptionTitleAttrString,
                    AttributedCaptionSummary = CaptionSummaryAttrString,
                    AttributedCaptionCredit  = CaptionCreditAttrString
                });
            }

            NYTPhoto initial = new NYTPhoto()
            {
                Image = UIImage.FromFile("cartoon1.jpg"),
                AttributedCaptionTitle   = attrString,
                AttributedCaptionSummary = attrString,
                AttributedCaptionCredit  = attrString
            };

            NYTPhotosViewController controller = new NYTPhotosViewController(photos.ToArray(), initial);

            controller.Delegate = new NYTPhotosControllerDelegate(button);
            this.PresentViewController(controller, true, null);
        }
示例#2
0
 /// <summary>
 /// References the view for photo.
 /// </summary>
 /// <returns>The view for photo.</returns>
 /// <param name="photosViewController">Photos view controller.</param>
 /// <param name="photo">Photo.</param>
 public override UIView ReferenceViewForPhoto(NYTPhotosViewController photosViewController, NYTPhoto photo)
 {
     //return base.ReferenceViewForPhoto(photosViewController, photo);
     return(_button);
 }
示例#3
0
 /// <summary>
 /// Maximums the zoom scale for photo.
 /// </summary>
 /// <returns>The zoom scale for photo.</returns>
 /// <param name="photosViewController">Photos view controller.</param>
 /// <param name="photo">Photo.</param>
 public override nfloat MaximumZoomScaleForPhoto(NYTPhotosViewController photosViewController, NYTPhoto photo)
 {
     return(5.0f);
 }