Пример #1
0
        public EditDialog() : base(null, true)
        {
            this.emojiCollectionView = new UICollectionView(CoreGraphics.CGRect.Empty, new LineLayout(new CGSize(320, 120), false));
            this.emojiCollectionView.RegisterClassForCell(typeof(EmojiCell), "emojiCell");
            this.emojiCollectionView.BackgroundColor = UIColor.White;
            List <String> strings = new List <String> ();

            strings.AddRange(EmojiFactory.GetEmojieCodes());
            EmojiSource source = new EmojiSource(strings);

            this.emojiCollectionView.Source = source;
            this.emojiCollectionView.Frame  = new CoreGraphics.CGRect(0, 0, 320, 120);

            this.imagesCollectionView = new UICollectionView(CoreGraphics.CGRect.Empty, new LineLayout(new CGSize(120, 120), false));
            this.imagesCollectionView.RegisterClassForCell(typeof(ImageCell), "imageCell");
            this.imagesCollectionView.BackgroundColor = UIColor.White;
            this.imagesCollectionView.Frame           = new CoreGraphics.CGRect(0, 0, 320, 120);

            this.videosCollectionView = new UICollectionView(CoreGraphics.CGRect.Empty, new LineLayout(new CGSize(120, 120), false));
            this.videosCollectionView.RegisterClassForCell(typeof(ImageCell), "imageCell");
            this.videosCollectionView.BackgroundColor = UIColor.White;
            this.videosCollectionView.Frame           = new CoreGraphics.CGRect(0, 0, 320, 120);

            this.titleElement              = new EntryElement("Title", "Title", "");
            this.commentElement            = new EntryElement("Comment", "Comment", "");
            this.mapView                   = new MKMapView();
            this.mapView.Layer.BorderColor = UIColor.Black.ColorWithAlpha(0.1f).CGColor;
            this.mapView.Layer.BorderWidth = 1f;
            this.mapView.Camera.Heading    = 0;
            this.mapView.Camera.Pitch      = 120;
            rotateCamera();
        }
Пример #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            CollectionView.RegisterClassForCell(typeof(EmojiCell), animalCellId);
            EmojiSource source = new EmojiSource(this.emojis);

            this.CollectionView.CollectionViewLayout = new LineLayout(new CGSize(this.CollectionView.Bounds.Width, this.CollectionView.Bounds.Width), true);
            this.CollectionView.BackgroundColor      = UIColor.White;
            CollectionView.Source = source;
            this.CreateButton.Layer.CornerRadius = 3f;
            this.CommentTextField.Started       += (sender, e) => {
                this.ScrollView.SetContentOffset(new CGPoint(0, 100), true);
            };
            this.CommentTextField.Ended += (sender, e) => {
                this.ScrollView.SetContentOffset(new CGPoint(0, 0), true);
            };

            this.CommentTextField.ReturnKeyType = UIReturnKeyType.Done;
            this.CommentTextField.ShouldReturn += (textField) => {
                this.CommentTextField.ResignFirstResponder();
                this.ScrollView.SetContentOffset(new CGPoint(0, 0), true);
                return(true);
            };
            this.CreateButton.TouchDown += (sender, e) => {
                String text   = ((EmojiCell)this.CollectionView.VisibleCells[0]).Text;
                Moment moment = new Moment()
                {
                    Title = "Emoji", Comment = "Not Edited"
                };
                moment.Emojis.Add(text);
                AppDelegate.MomentsManager.PublishMoment(moment);
                this.NavigationController.PopViewController(true);
                if (this.Finished != null)
                {
                    this.Finished(moment);
                }
            };
        }